17. Entity Relationship Model
(االرتباطات و الكيانات )نموذج
■ A software release can be identified either by:
– major/minor version or by the date.
■ (year, major, minor) or (year, month, date, major)
– are super keys (since they are unique)
– but not candidate keys, (since you can remove year or major and the remaining
set will still be a super key)
■ (year, month, date) and (major, minor)
– are candidate keys, since you cannot remove any of the fields from them
without breaking uniqueness.
Year Month Date Major Minor
2008 01 13 0 1
2008 04 23 0 2
2009 11 05 1 0
2010 04 05 1 1
2020 By Eng. Joud Khattab
18. Entity Relationship Diagram (ERD)
( كيان مخطط-ارتباط )
One to One One to Many
Many to Many
2020 By Eng. Joud Khattab
30. Data Definition Language (DDL)
(المعطيات تعريف )لغة
■ Create a Table (جدول )بناء
■ Examples:
– create table instructor (
ID char(5),
name varchar(20) not null,
dept_name varchar(20),
salary numeric(8,2),
primary key (ID),
foreign key (dept_name) references department)
2020 By Eng. Joud Khattab
31. Data Definition Language (DDL)
(المعطيات تعريف )لغة
■ Alter & Drop Tables: (وحذفها الجداول )تعديل
■ Examples:
– alter table r add A D
– alter table r drop A
– drop table r
2020 By Eng. Joud Khattab
32. Data Manipulation Language (DML)
(المعطيات مع التعامل )لغة
■ Insert ()اإلدخال
■ Examples:
– insert into course
values (’CS-437’, ’Database Systems’, ’Comp. Sci.’, 4);
– insert into course (course_id, title, credits, dept_name)
values (’CS-437’, ’Database Systems’, 4, ’Comp. Sci.’);
– insert into student
values (’3003’, ’Green’, ’Finance’, null);
– insert into student
select ID, name, dept_name, 0
from instructor;
– insert into table1 select * from table1;
2020 By Eng. Joud Khattab
33. Data Manipulation Language (DML)
(المعطيات مع التعامل )لغة
■ Update ()التعديل
■ Examples:
– update instructor
set salary = salary * 1.03
where salary > 100000;
2020 By Eng. Joud Khattab
34. Data Manipulation Language (DML)
(المعطيات مع التعامل )لغة
■ Delete ()الحذف
– delete from instructor
– delete from instructor
where dept name in (select dept name
from department
where building = ’Watson’);
– delete from instructor
where salary < (select avg (salary) from instructor);
2020 By Eng. Joud Khattab
35. Select Clause
Rule
■ Rule:
select A1, A2, ..., An
from r1, r2, ..., rm
where P
■ Examples:
– select *
from instructor
– select ID, name, salary/12
from instructor
– select distinct dept_name
from instructor
2020 By Eng. Joud Khattab
36. Select Clause
Conditions
■ select name
from instructor
where dept_name = ‘Comp. Sci.' and salary > 80000
■ select name, course_id
from instructor, teaches
where (instructor.ID, dept_name) = (teaches.ID, ’Biology’);
2020 By Eng. Joud Khattab
44. Select Clause
Set Operations (المجموعات على )العمليات
■ (select course_id from section where sem = ‘Fall’ and year = 2009)
union
(select course_id from section where sem = ‘Spring’ and year = 2010)
■ (select course_id from section where sem = ‘Fall’ and year = 2009)
intersect
(select course_id from section where sem = ‘Spring’ and year = 2010)
■ (select course_id from section where sem = ‘Fall’ and year = 2009)
except
(select course_id from section where sem = ‘Spring’ and year = 2010)
■مالحظة:
–آلي حذفللتكرارس
–العمليات تستخدم التكرار إلبقاءunion all, intersect all, except all
2020 By Eng. Joud Khattab
45. Select Clause
Null Values (المعدومة )القيم
■واردة غير أو معروفة غير أو موجودة غير قيمة
■القيمة كانت إذا نختبر أن يمكنnullالشرط باستخدامis null
■ select name
from instructor
where salary is null;
■القيمة تتضمن رياضية عملية نتيجةnullهيnull(5 + null = null)
■ OR: (unknown or true) = true
(unknown or false) = unknown
(unknown or unknown) = unknown
■ AND: (true and unknown) = unknown
(false and unknown) = false,
(unknown and unknown) = unknown
■ NOT: (not unknown) = unknown
■الطرفين أحد كان إذا المقارنة عمليات فيnullالنتيجة تكونunknown
■التركيب نتيجةwhereأنها على معها التعامل يجريfalseتساوي كانت إذاunknown
2020 By Eng. Joud Khattab
46. Select Clause
Aggregate Functions (التجميع )توابع
■واحدة قيمة وتعيد قيم مجموعة دخلها في تأخذ توابع
■ select avg (salary)
from instructor
where dept_name= ’Comp. Sci.’;
■ select count (*)
from course;
■ select count (distinct ID)
from teaches
where semester = ’Spring’ and year = 2010;
■القيمة التجميع توابع تجاهلnull
avg: average value
min: minimum value
max: maximum value
sum: sum of values
count: number of values
2020 By Eng. Joud Khattab
47. Select Clause
Group By (واصفة بحسب )التجميع
■مالحظات:
–واصفة من أكثر على التجميع يمكن
–قائمة في التجميعي التابع خارج الموجودة الواصفات جميع تظهر أن يجبgroup by
select dept_name, avg (salary)
from instructor
group by dept_name;
2020 By Eng. Joud Khattab
48. Select Clause
Having التجميع على الشروط
■مالحظة:
–في الموجود الشرط يطبقhavingشرط يطبق بينما المجموعات تشكيل بعدwhereتشكيلها قبل
select dept_name, avg (salary)
from instructor
group by dept_name
having avg (salary) > 42000;
2020 By Eng. Joud Khattab
49. Views ()الرؤى
■الجداول على المعقدة االستعالمات لتسهيل وسيلة.
■ًفعليا مخزنة غير افتراضية جداول.
■بلغة مكتوبة اسم ولها مخزنة استعالماتSQL
■آخر جدول كأي استخدامها يمكن إنشائها بعد
■باستخدامها أخرى رؤية إنشاء حتى أو
■ create view v as < query expression >
– create view faculty as
select ID, name, dept_name
from instructor;
– select name
from faculty
where dept_name = ‘Biology’;
– create view bio_faculty as
select *
from faculty
where dept_name = ‘Biology’;
2020 By Eng. Joud Khattab
51. أخرى معطيات أنماط
■ Date:
– day, month, year ‘2005-7-27’
■ Time:
– hours, minutes, seconds ‘09:00:30’, ‘09:00:30.75’
■ Timestamp:
– date + time ‘2005-7-27 09:00:30.75’
■ interval period of time:
– timestamp1- timestamp2
■ Blob:
– binary large object (image, sound, movie, …)
■ Clob:
– character large object (memo, text book, …)
2020 By Eng. Joud Khattab
52. Question 1
■ The attributes made up of more than one single attributes are called:
A. Derived attribute
B. Composite attribute
C. Single value attribute
D. Multi value attribute
2020 By Eng. Joud Khattab
53. Question 1
■ The attributes made up of more than one single attributes are called:
A. Derived attribute
B. Composite attribute
C. Single value attribute
D. Multi value attribute
2020 By Eng. Joud Khattab
54. Question 2
■ Operations such as “and”. The result of:
true and unknown is _____
false and unknown is _____
unknown and unknown is _____
A. Unknown, unknown, false
B. True, false, unknown
C. True, unknow, unknown
D. Unknown, false, unknown
2020 By Eng. Joud Khattab
55. Question 2
■ Operations such as “and”. The result of:
true and unknown is _____
false and unknown is _____
unknown and unknown is _____
A. Unknown, unknown, false
B. True, false, unknown
C. True, unknow, unknown
D. Unknown, false, unknown
2020 By Eng. Joud Khattab
56. Question 3
■ Using the _____ clause retains only one copy of such identical tuples.
A. Null
B. Unique
C. Not null
D. Distinct
2020 By Eng. Joud Khattab
57. Question 3
■ Using the _____ clause retains only one copy of such identical tuples.
A. Null
B. Unique
C. Not null
D. Distinct
2020 By Eng. Joud Khattab
58. Question 4
■ In an employee table to include the attributes whose “value always have some
value” which of the following constraint must be used?
A. Null
B. Not null
C. Unique
D. Distinct
2020 By Eng. Joud Khattab
59. Question 4
■ In an employee table to include the attributes whose “value always have some
value” which of the following constraint must be used?
A. Null
B. Not null
C. Unique
D. Distinct
2020 By Eng. Joud Khattab
60. Question 5
■ Aggregate functions are functions that take a _____ as input and return a single
value.
A. Collection of values
B. Single value
C. Aggregate value
D. Both collection of values & single value
2020 By Eng. Joud Khattab
61. Question 5
■ Aggregate functions are functions that take a _____ as input and return a single
value.
A. Collection of values
B. Single value
C. Aggregate value
D. Both collection of values & single value
2020 By Eng. Joud Khattab
62. Question 6
■ All aggregate functions except _____ ignore null values in their input collection.
A. Count(attribute)
B. Count(*)
C. Avg
D. Sum
2020 By Eng. Joud Khattab
63. Question 6
■ All aggregate functions except _____ ignore null values in their input collection.
A. Count(attribute)
B. Count(*)
C. Avg
D. Sum
2020 By Eng. Joud Khattab
64. Question 7
■ Aggregate functions can be used in the select list or the _____ clause of a select
statement or subquery. They cannot be used in a _____ clause.
A. Where, having
B. Having, where
C. Group by, having
D. Group by, where
2020 By Eng. Joud Khattab
65. Question 7
■ Aggregate functions can be used in the select list or the _____ clause of a select
statement or subquery. They cannot be used in a _____ clause.
A. Where, having
B. Having, where
C. Group by, having
D. Group by, where
2020 By Eng. Joud Khattab
66. Question 8
■ Which of the following deletes all the entries but keeps the structure of the relation.
A. Delete from r where P;
B. Delete from instructor where dept name = ‘Finance’;
C. Delete from instructor where salary between 13000 and 15000;
D. Delete from instructor;
2020 By Eng. Joud Khattab
67. Question 8
■ Which of the following deletes all the entries but keeps the structure of the relation.
A. Delete from r where P;
B. Delete from instructor where dept name = ‘Finance’;
C. Delete from instructor where salary between 13000 and 15000;
D. Delete from instructor;
2020 By Eng. Joud Khattab
68. Question 9
■ Fill in with correct keyword to update the instructor relation
Update instructor _____ salary = salary * 1.05;
A. Where
B. Set
C. In
D. select
2020 By Eng. Joud Khattab
69. Question 9
■ Fill in with correct keyword to update the instructor relation
Update instructor _____ salary = salary * 1.05;
A. Where
B. Set
C. In
D. select
2020 By Eng. Joud Khattab
70. Question 10
■ Which of the join operations do not preserve non matched tuples?
A. Left outer join
B. Right outer join
C. Inner join
D. Natural join
2020 By Eng. Joud Khattab
71. Question 10
■ Which of the join operations do not preserve non matched tuples?
A. Left outer join
B. Right outer join
C. Inner join
D. Natural join
2020 By Eng. Joud Khattab
72. Question 11
■ How many tables may be included with a join?
A. One
B. Two
C. Three
D. All of the mentioned
2020 By Eng. Joud Khattab
73. Question 11
■ How many tables may be included with a join?
A. One
B. Two
C. Three
D. All of the mentioned
2020 By Eng. Joud Khattab
74. Question 12
■ Data integrity constraints are used to:
A. Control who is allowed access to the data
B. Ensure that duplicate records are not entered into the table
C. Improve the quality of data entered for a specific property
D. Prevent users from changing the values stored in the table
2020 By Eng. Joud Khattab
75. Question 12
■ Data integrity constraints are used to:
A. Control who is allowed access to the data
B. Ensure that duplicate records are not entered into the table
C. Improve the quality of data entered for a specific property
D. Prevent users from changing the values stored in the table
2020 By Eng. Joud Khattab
76. Question 13
■ In order to ensure that an instructor’s salary domain allows only values greater than
a specified value use:
A. Value >= 30000.00
B. Not null;
C. Check(value >= 29000.00);
D. Check(value)
2020 By Eng. Joud Khattab
77. Question 13
■ In order to ensure that an instructor’s salary domain allows only values greater than
a specified value use:
A. Value >= 30000.00
B. Not null;
C. Check(value >= 29000.00);
D. Check(value)
2020 By Eng. Joud Khattab
78. Question 14
■ Which of the following statement is used to remove the privilege from the user Amir?
A. Remove update on department from Amir
B. Revoke update on employee from Amir
C. Delete select on department from Raj
D. Grant update on employee from Amir
2020 By Eng. Joud Khattab
79. Question 14
■ Which of the following statement is used to remove the privilege from the user Amir?
A. Remove update on department from Amir
B. Revoke update on employee from Amir
C. Delete select on department from Raj
D. Grant update on employee from Amir
2020 By Eng. Joud Khattab
80. Question 15
■ Which of the following is another name for a weak entity?
A. Child
B. Owner
C. Dominant
D. All of the mentioned
2020 By Eng. Joud Khattab
81. Question 15
■ Which of the following is another name for a weak entity?
A. Child
B. Owner
C. Dominant
D. All of the mentioned
2020 By Eng. Joud Khattab
82. Question 16
■ E-R model uses which symbol to represent weak entity set:
A. Dotted rectangle
B. Diamond
C. Doubly outlined rectangle
D. None of the above
2020 By Eng. Joud Khattab
83. Question 16
■ E-R model uses which symbol to represent weak entity set:
A. Dotted rectangle
B. Diamond
C. Doubly outlined rectangle
D. None of the above
2020 By Eng. Joud Khattab
85. XML
■ Structure
– Elements and Attributes
– Namespaces
– DTD
– XML Schema
■ Query
– XPath
– XQuery (FLOWER)
– XSLT
2020 By Eng. Joud Khattab
86. XML Introduction
■ XML (eXtensible Markup Language)
■ semi-structured data models.
■ Derived from SGML (Standard Generalized Markup Language)
■ Documents have tags giving extra information about sections of the document
– <title> XML </title> <slide> Introduction …</slide>
■ Extensible, unlike HTML Users can add new tags.
■ The ability to specify new tags, and to create nested tag structures make XML a
great way to exchange data, not just documents.
■ Elements must be properly nested
2020 By Eng. Joud Khattab
87. XML Namespaces
■ Usage:
– XML data has to be exchanged between organizations.
– Same tag name may have different meaning in different organizations, causing confusion on
exchanged documents.
■ Example:
<university xmlns:yale=“http://www.yale.edu”>
…
<yale:course>
<yale:course_id> CS-101 </yale:course_id>
<yale:title> Intro. to Computer Science</yale:title>
<yale:dept_name> Comp. Sci. </yale:dept_name>
<yale:credits> 4 </yale:credits>
</yale:course>
…
</university>
2020 By Eng. Joud Khattab
88. XML (DTD)
Document Type Definition
■ The type of an XML document can be specified using a DTD
■ DTD constraints structure of XML data
– What elements can occur
– What attributes can/must an element have
– What subelements can/must occur inside each element, and how many times.
■ DTD does not constrain data types
– All values represented as strings in XML
■ DTD syntax
– <!ELEMENT element (subelements-specification) >
– <!ATTLIST element (attributes) >
2020 By Eng. Joud Khattab
89. XML Schema
■ XML Schema is a more sophisticated schema language which addresses the
drawbacks of DTDs.
■ Supports:
– Typing of values
■ integer, string, etc
■ constraints on min/max values
– User-defined, complex types
– Many more features, including
■ uniqueness and foreign key constraints, inheritance
2020 By Eng. Joud Khattab
90. XML XPath
■ XPath is used to address (select) parts of documents using path expressions
■ A path expression is a sequence of steps separated by “/”
■ Examples:
– /university-3/instructor/name
■ <name>Srinivasan</name>
■ <name>Brandt</name>
– /university-3/instructor/name/text( )
■ returns the same names, but without the enclosing tags
– /university-3/course[credits >= 4]
■ returns course elements with a credit value greater or equal 4
– /university-3/course[credits >= 4]/@course_id
■ returns the course identifiers of courses with credits >= 4
2020 By Eng. Joud Khattab
91. XML XQuery
■ XQuery is a general purpose query language for XML data
■ XQuery uses a
for … let … where … order by … return…
■ Syntax
– For <--> SQL from
– Where <--> SQL where
– order by <--> SQL order by
– return <--> SQL select
– let allows temporary variables, and has no equivalent in SQL
2020 By Eng. Joud Khattab
92. XML XQuery
FLWOR Syntax
■ Examples:
– find all courses with credits > 3, with each result enclosed in an <course_id> ..
</course_id> tag
for $x in /university-3/course
let $courseId := $x/@course_id
where $x/credits > 3
return <course_id> { $courseId } </course id>
■ Items in the return clause are XML text unless enclosed in {}, in which case they are
evaluated
2020 By Eng. Joud Khattab
93. Question 1
■ What does XML stand for?
A. eXtra Modern Link
B. eXtensible Markup Language
C. Example Markup Language
D. X-Markup Language
2020 By Eng. Joud Khattab
94. Question 1
■ What does XML stand for?
A. eXtra Modern Link
B. eXtensible Markup Language
C. Example Markup Language
D. X-Markup Language
2020 By Eng. Joud Khattab
95. Question 2
■ What is the correct syntax of the declaration which defines the XML version?
A. <xml version=“1.0”/>
B. <?xml version=“1.0”?>
C. <?xml version=“1.0”/>
D. None of the above
2020 By Eng. Joud Khattab
96. Question 2
■ What is the correct syntax of the declaration which defines the XML version?
A. <xml version=“1.0”/>
B. <?xml version=“1.0”?>
C. <?xml version=“1.0”/>
D. None of the above
2020 By Eng. Joud Khattab
97. Question 3
■ Is it easier to process XML than HTML?
A. Yes
B. No
C. Sometimes
D. Cant say
2020 By Eng. Joud Khattab
98. Question 3
■ Is it easier to process XML than HTML?
A. Yes
B. No
C. Sometimes
D. Cant say
2020 By Eng. Joud Khattab
99. Question 4
■ Kind of Parsers are
A. Well-formed
B. Well-documented
C. Non-validating and validating
D. None of the above
2020 By Eng. Joud Khattab
100. Question 4
■ Kind of Parsers are
A. Well-formed
B. Well-documented
C. Non-validating and validating
D. None of the above
2020 By Eng. Joud Khattab
101. Question 5
■ Well formed XML document means
A. It contains a root element
B. It contain an element
C. It contains one or more elements
D. Must contain one or more elements and root element must contain all other
elements
2020 By Eng. Joud Khattab
102. Question 5
■ Well formed XML document means
A. It contains a root element
B. It contain an element
C. It contains one or more elements
D. Must contain one or more elements and root element must contain all other
elements
2020 By Eng. Joud Khattab
103. Question 6
■ Comment in XML document is given by
A. <?-- -->
B. <!-- --!>
C. <!-- -->
D. </-- -->
2020 By Eng. Joud Khattab
104. Question 6
■ Comment in XML document is given by
A. <?-- -->
B. <!-- --!>
C. <!-- -->
D. </-- -->
2020 By Eng. Joud Khattab
105. Question 7
■ XML uses the features of
A. HTML
B. XHTML
C. VML
D. SGML
2020 By Eng. Joud Khattab
106. Question 7
■ XML uses the features of
A. HTML
B. XHTML
C. VML
D. SGML
2020 By Eng. Joud Khattab
107. Question 8
■ What does DTD stand for?
A. Direct Type Definition
B. Document Type Definition
C. Dynamic Type Definition
2020 By Eng. Joud Khattab
108. Question 8
■ What does DTD stand for?
A. Direct Type Definition
B. Document Type Definition
C. Dynamic Type Definition
2020 By Eng. Joud Khattab
109. Question 9
■ Which of the following XML fragments are well-formed?
A. <myElement myAttribute=“someValue”/>
B. <myElement myAttribute=someValue/>
C. <myElement myAttribute=‘someValue’/>
D. <myElement myAttribute=“someValue’/>
2020 By Eng. Joud Khattab
110. Question 9
■ Which of the following XML fragments are well-formed?
A. <myElement myAttribute=“someValue”/>
B. <myElement myAttribute=someValue/>
C. <myElement myAttribute=‘someValue’/>
D. <myElement myAttribute=“someValue’/>
2020 By Eng. Joud Khattab
111. Question 10
■ How can we make attributes have multiple values:
A. <myElement myAttribute=“value1 value2”/>
B. <myElement myAttribute=“value1” myAttribute=“value2”/>
C. <myElement myAttribute=“value1,value2”/>
D. Attributes cannot have multiple values
2020 By Eng. Joud Khattab
112. Question 10
■ How can we make attributes have multiple values:
A. <myElement myAttribute=“value1 value2”/>
B. <myElement myAttribute=“value1” myAttribute=“value2”/>
C. <myElement myAttribute=“value1,value2”/>
D. Attributes cannot have multiple values
2020 By Eng. Joud Khattab
113. Question 11
■ In XML
A. The internal DTD subset is read before the external DTD
B. The external DTD subset is read before the internal DTD
C. There is no external type of DTD
D. There is no internal type of DTD
2020 By Eng. Joud Khattab
114. Question 11
■ In XML
A. The internal DTD subset is read before the external DTD
B. The external DTD subset is read before the internal DTD
C. There is no external type of DTD
D. There is no internal type of DTD
2020 By Eng. Joud Khattab
115. Question 12
■ Is this a “well formed” XML document?
<?xml version=“1.0”?>
<note>
<to age=29>Tove</to>
<from>Jani</from>
</note>
A. True
B. False
2020 By Eng. Joud Khattab
116. Question 12
■ Is this a “well formed” XML document?
<?xml version=“1.0”?>
<note>
<to age=29>Tove</to>
<from>Jani</from>
</note>
A. True
B. False
2020 By Eng. Joud Khattab
117. Question 13
■ XML preserves white spaces
A. True
B. False
2020 By Eng. Joud Khattab
118. Question 13
■ XML preserves white spaces
A. True
B. False
2020 By Eng. Joud Khattab
121. Normalization Process
■ Every table in your Database should at least follow the 1st Normal Form, always.
■ Or stop using Database!!
2020 By Eng. Joud Khattab
122. 1st Normal Form
■ There are 4 basic rules that a table should follow to be in 1st Normal Form.
2020 By Eng. Joud Khattab
123. 1st Normal Form
Rule 1
■ Each column should contain atomic
values.
■ Entries like X,Y and W,X violate this
rule.
2020 By Eng. Joud Khattab
124. 1st Normal Form
Rule 2
■ A column should contain values that
are of the same type.
■ Do not inter-mix different types of
values in any column.
2020 By Eng. Joud Khattab
125. 1st Normal Form
Rule 3
■ Each column should have a unique
name.
■ Same names leads to confusion at the
time of data retrieval.
2020 By Eng. Joud Khattab
126. 1st Normal Form
Rule 4
■ Order in which data is saved doesn’t
matter.
■ Using SQL query. You can easily fetch
data in any order from a table.
2020 By Eng. Joud Khattab
130. 2nd Normal Form
■ For a table to be in the Second Normal Form:
– It should be in 1st Normal Form.
– And, it should not have any Partial Dependencies.
2020 By Eng. Joud Khattab
131. 2nd Normal Form
What is Partial Dependency?
■ To understand Partial Dependency.
■ We first need to understand what Dependency is?
2020 By Eng. Joud Khattab
134. 2nd Normal Form
What is Partial Dependency?
■ Primary Key should be score_id
■ But student_id + subject_id together makes a more meaningful primary key.
2020 By Eng. Joud Khattab
143. 3rd Normal Form
■ For a table to be in 3rd Normal Form:
– It should be in 2nd Normal Form.
– And it should not have Transitive Dependency.
2020 By Eng. Joud Khattab
147. 3.5 Normal Form (BCNF)
Boyce-Codd Normal Form
■ Tables should satisfy 2 conditions:
– It should be in the 3rd Normal Form.
– For any dependency A → B, A should be a super key.
2020 By Eng. Joud Khattab
148. 3.5 Normal Form (BCNF)
Boyce-Codd Normal Form
2020 By Eng. Joud Khattab
149. 3.5 Normal Form (BCNF)
Boyce-Codd Normal Form
2020 By Eng. Joud Khattab
150. 3.5 Normal Form (BCNF)
Boyce-Codd Normal Form
2020 By Eng. Joud Khattab
151. 4th Normal Form
■ It should satisfy BCNF.
■ It should not have Multi-Valued Dependency.
2020 By Eng. Joud Khattab
155. Question 1
■ In the _____ normal form, a composite attribute is converted to individual attributes.
A. First
B. Second
C. Third
D. Fourth
2020 By Eng. Joud Khattab
156. Question 1
■ In the _____ normal form, a composite attribute is converted to individual attributes.
A. First
B. Second
C. Third
D. Fourth
2020 By Eng. Joud Khattab
157. Question 2
■ Tables in second normal form (2NF)
A. Eliminate all hidden dependencies
B. Eliminate the possibility of a insertion anomalies
C. Have a composite key
D. Have all non key fields depend on the whole primary key
2020 By Eng. Joud Khattab
158. Question 2
■ Tables in second normal form (2NF)
A. Eliminate all hidden dependencies
B. Eliminate the possibility of a insertion anomalies
C. Have a composite key
D. Have all non key fields depend on the whole primary key
2020 By Eng. Joud Khattab
159. Question 3
■ Which forms are based on the concept of functional dependency
A. 1NF
B. 2NF
C. 3NF
D. 4NF
2020 By Eng. Joud Khattab
160. Question 3
■ Which forms are based on the concept of functional dependency
A. 1NF
B. 2NF
C. 3NF
D. 4NF
2020 By Eng. Joud Khattab
162. Question 1
■ If E1 and E2 are relational algebra expressions, then which of the following is NOT a
relational algebra expression?
A. E1 ∪ E2
B. E1 / E2
C. E1 – E2
D. E1 x E2
2020 By Eng. Joud Khattab
163. Question 1
■ If E1 and E2 are relational algebra expressions, then which of the following is NOT a
relational algebra expression?
A. E1 ∪ E2
B. E1 / E2
C. E1 – E2
D. E1 x E2
2020 By Eng. Joud Khattab
164. Question 2
■ Which clause from the following corresponds to the projection operation of the
relational algebra?
A. From
B. Select
C. Where
D. Group by
2020 By Eng. Joud Khattab
165. Question 2
■ Which clause from the following corresponds to the projection operation of the
relational algebra?
A. From
B. Select
C. Where
D. Group by
2020 By Eng. Joud Khattab
167. Question 1
■ A relational database consists of a collection of
A. Tables
B. Fields
C. Records
D. Keys
2020 By Eng. Joud Khattab
168. Question 1
■ A relational database consists of a collection of
A. Tables
B. Fields
C. Records
D. Keys
2020 By Eng. Joud Khattab
169. Question 2
■ The term _______ is used to refer to a row.
A. Attribute
B. Tuple
C. Field
D. Instance
2020 By Eng. Joud Khattab
170. Question 2
■ The term _______ is used to refer to a row.
A. Attribute
B. Tuple
C. Field
D. Instance
2020 By Eng. Joud Khattab
171. Question 3
■ The term attribute refers to a ___________ of a table.
A. Record
B. Column
C. Tuple
D. Key
2020 By Eng. Joud Khattab
172. Question 3
■ The term attribute refers to a ___________ of a table.
A. Record
B. Column
C. Tuple
D. Key
2020 By Eng. Joud Khattab
173. Question 4
■ Database __________ which is the logical design of the database, and the database
_______ which is a snapshot of the data in the database at a given instant in time.
A. Instance, Schema
B. Relation, Schema
C. Relation, Domain
D. Schema, Instance
2020 By Eng. Joud Khattab
174. Question 4
■ Database __________ which is the logical design of the database, and the database
_______ which is a snapshot of the data in the database at a given instant in time.
A. Instance, Schema
B. Relation, Schema
C. Relation, Domain
D. Schema, Instance
2020 By Eng. Joud Khattab
175. Question 5
■ Course (course_id,sec_id,semester)
Here the course_id,sec_id and semester are __________ and course is a _________
A. Relations, Attribute
B. Attributes, Relation
C. Tuple, Relation
D. Tuple, Attributes
2020 By Eng. Joud Khattab
176. Question 5
■ Course (course_id,sec_id,semester)
Here the course_id,sec_id and semester are __________ and course is a _________
A. Relations, Attribute
B. Attributes, Relation
C. Tuple, Relation
D. Tuple, Attributes
2020 By Eng. Joud Khattab
177. Question 6
■ The tuples of the relations can be of ________ order
A. Any
B. Same
C. Sorted
D. Constant
2020 By Eng. Joud Khattab
178. Question 6
■ The tuples of the relations can be of ________ order
A. Any
B. Same
C. Sorted
D. Constant
2020 By Eng. Joud Khattab
179. Question 7
■ Which one of the following attribute can be taken as a primary key ?
A. Name
B. Street
C. Id
D. Department
2020 By Eng. Joud Khattab
180. Question 7
■ Which one of the following attribute can be taken as a primary key ?
A. Name
B. Street
C. Id
D. Department
2020 By Eng. Joud Khattab
181. Question 8
■ The ______ is the one in which the primary key of one relation is used as a normal
attribute in another relation.
A. Referential relation
B. Referencing relation
C. Referenced relation
D. Referred relation
2020 By Eng. Joud Khattab
182. Question 8
■ The ______ is the one in which the primary key of one relation is used as a normal
attribute in another relation.
A. Referential relation
B. Referencing relation
C. Referenced relation
D. Referred relation
2020 By Eng. Joud Khattab
183. Question 9
■ The _____ operation allows the combining of two relations by merging pairs of
tuples, one from each relation, into a single tuple
A. Select
B. Join
C. Union
D. Intersection
2020 By Eng. Joud Khattab
184. Question 9
■ The _____ operation allows the combining of two relations by merging pairs of
tuples, one from each relation, into a single tuple
A. Select
B. Join
C. Union
D. Intersection
2020 By Eng. Joud Khattab
185. Question 10
■ The result which operation contains all pairs of tuples from the two relations,
regardless of whether their attribute values match
A. Join
B. Cartesian product
C. Intersection
D. Set difference
2020 By Eng. Joud Khattab
186. Question 10
■ The result which operation contains all pairs of tuples from the two relations,
regardless of whether their attribute values match
A. Join
B. Cartesian product
C. Intersection
D. Set difference
2020 By Eng. Joud Khattab
187. Question 11
■ The _______ operation performs a set union of two “similarly structured” tables
A. Union
B. Join
C. Product
D. Intersect
2020 By Eng. Joud Khattab
188. Question 11
■ The _______ operation performs a set union of two “similarly structured” tables
A. Union
B. Join
C. Product
D. Intersect
2020 By Eng. Joud Khattab
189. Question 12
■ The _______ operator takes the results of two queries and returns only rows that
appear in both result sets
A. Union
B. Intersect
C. Difference
D. Projection
2020 By Eng. Joud Khattab
190. Question 12
■ The _______ operator takes the results of two queries and returns only rows that
appear in both result sets
A. Union
B. Intersect
C. Difference
D. Projection
2020 By Eng. Joud Khattab
191. Question 13
■ Which one of the following is used to define the structure of the relation ,deleting
relations and relating schemas ?
A. DML (Data Manipulation Language)
B. DDL (Data Definition Language)
C. Query
D. Relational Schema
2020 By Eng. Joud Khattab
192. Question 13
■ Which one of the following is used to define the structure of the relation ,deleting
relations and relating schemas ?
A. DML (Data Manipulation Language)
B. DDL (Data Definition Language)
C. Query
D. Relational Schema
2020 By Eng. Joud Khattab
193. Question 14
■ Which one of the following provides the ability to query information from the
database and to insert tuples into, delete tuples from, and modify tuples in the
database ?
A. DML (Data Manipulation Language)
B. DDL (Data Definition Language)
C. Query
D. Relational Schema
2020 By Eng. Joud Khattab
194. Question 14
■ Which one of the following provides the ability to query information from the
database and to insert tuples into, delete tuples from, and modify tuples in the
database ?
A. DML (Data Manipulation Language)
B. DDL (Data Definition Language)
C. Query
D. Relational Schema
2020 By Eng. Joud Khattab
195. Question 15
■ The basic data type char(n) is a _____ length character string and varchar(n) is
_____ length character.
A. Fixed, equal
B. Equal, variable
C. Fixed, variable
D. Variable, equal
2020 By Eng. Joud Khattab
196. Question 15
■ The basic data type char(n) is a _____ length character string and varchar(n) is
_____ length character.
A. Fixed, equal
B. Equal, variable
C. Fixed, variable
D. Variable, equal
2020 By Eng. Joud Khattab
197. Question 16
■ Insert into instructor values (10211, ’Smith’, ’Biology’, 66000);
What type of statement is this ?
A. Query
B. DML
C. Relational
D. DDL
2020 By Eng. Joud Khattab
198. Question 16
■ Insert into instructor values (10211, ’Smith’, ’Biology’, 66000);
What type of statement is this ?
A. Query
B. DML
C. Relational
D. DDL
2020 By Eng. Joud Khattab
199. Question 17
■ Select ________ dept_name
from instructor;
Here which of the following displays the unique values of the column ?
A. All
B. From
C. Distinct
D. Name
2020 By Eng. Joud Khattab
200. Question 17
■ Select ________ dept_name
from instructor;
Here which of the following displays the unique values of the column ?
A. All
B. From
C. Distinct
D. Name
2020 By Eng. Joud Khattab
201. Question 18
■ The ______ clause allows us to select only those rows in the result relation of the
____ clause that satisfy a specified predicate
A. Where, from
B. From, select
C. Select, from
D. From, where
2020 By Eng. Joud Khattab
202. Question 18
■ The ______ clause allows us to select only those rows in the result relation of the
____ clause that satisfy a specified predicate
A. Where, from
B. From, select
C. Select, from
D. From, where
2020 By Eng. Joud Khattab
203. Question 19
■ Which of the following statements contains an error?
A. Select * from emp where emp id = 10003;
B. Select empid from emp where lastname = GELLER;
C. Select emp id from emp;
D. Select empid where empid = 1009 and lastname = ‘GELLER’;
2020 By Eng. Joud Khattab
204. Question 19
■ Which of the following statements contains an error?
A. Select * from emp where emp id = 10003;
B. Select empid from emp where lastname = GELLER;
C. Select emp id from emp;
D. Select empid where empid = 1009 and lastname = ‘GELLER’;
2020 By Eng. Joud Khattab
205. Question 20
■ Which keyword must be used here to rename the field name ?
A. From
B. Rename
C. As
D. Join
2020 By Eng. Joud Khattab
206. Question 20
■ Which keyword must be used here to rename the field name ?
A. From
B. Rename
C. As
D. Join
2020 By Eng. Joud Khattab
207. Question 21
■ SELECT * FROM employee WHERE dept_name="Comp Sci";
■ In the SQL given above there is an error . Identify the error
A. Dept_name
B. Employee
C. “Comp Sci”
D. From
2020 By Eng. Joud Khattab
208. Question 21
■ SELECT * FROM employee WHERE dept_name="Comp Sci";
■ In the SQL given above there is an error . Identify the error
A. Dept_name
B. Employee
C. “Comp Sci”
D. From
2020 By Eng. Joud Khattab
209. Question 22
■ SELECT emp_name FROM department
■ WHERE dept_name LIKE ’ __ Computer Science’;
■ Which one of the following has to be added into the blank to select the dept_name
which has Computer Science as its ending string ?
A. %
B. _
C. ||
D. $
2020 By Eng. Joud Khattab
210. Question 22
■ SELECT emp_name FROM department
■ WHERE dept_name LIKE ’ __ Computer Science’;
■ Which one of the following has to be added into the blank to select the dept_name
which has Computer Science as its ending string ?
A. %
B. _
C. ||
D. $
2020 By Eng. Joud Khattab
211. Question 23
■ ’_ _ _ ’ matches any string of ______ three characters.
■ ’_ _ _ %’ matches any string of ______ three characters.
A. At least, Exactly
B. Exactly, At least
C. At least, All
D. All, Exactly
2020 By Eng. Joud Khattab
212. Question 23
■ ’_ _ _ ’ matches any string of ______ three characters.
■ ’_ _ _ %’ matches any string of ______ three characters.
A. At least, Exactly
B. Exactly, At least
C. At least, All
D. All, Exactly
2020 By Eng. Joud Khattab
213. Question 24
■ By default, the order by clause lists items in ______ order.
A. Descending
B. Any
C. Same
D. Ascending
2020 By Eng. Joud Khattab
214. Question 24
■ By default, the order by clause lists items in ______ order.
A. Descending
B. Any
C. Same
D. Ascending
2020 By Eng. Joud Khattab
215. Question 25
■ To display the salary from greater to smaller and name in ascending order which of
the following options should be used?
A. Ascending, Descending
B. Asc, Desc
C. Desc, Asc
D. Descending, Ascending
2020 By Eng. Joud Khattab
216. Question 25
■ To display the salary from greater to smaller and name in ascending order which of
the following options should be used?
A. Ascending, Descending
B. Asc, Desc
C. Desc, Asc
D. Descending, Ascending
2020 By Eng. Joud Khattab
217. Question 26
■ SELECT instructor.*
■ FROM instructor, teaches
■ WHERE instructor.ID= teaches.ID;
■ This query does which of the following operation?
A. All attributes of instructor and teaches are selected
B. All attributes of instructor are selected on the given condition
C. All attributes of teaches are selected on given condition
D. Only the some attributes from instructed and teaches are selected
2020 By Eng. Joud Khattab
218. Question 26
■ SELECT instructor.*
■ FROM instructor, teaches
■ WHERE instructor.ID= teaches.ID;
■ This query does which of the following operation?
A. All attributes of instructor and teaches are selected
B. All attributes of instructor are selected on the given condition
C. All attributes of teaches are selected on given condition
D. Only the some attributes from instructed and teaches are selected
2020 By Eng. Joud Khattab
219. Question 27
■ In SQL the spaces at the end of the string are removed by _______ function
A. Upper
B. String
C. Trim
D. Lower
2020 By Eng. Joud Khattab
220. Question 27
■ In SQL the spaces at the end of the string are removed by _______ function
A. Upper
B. String
C. Trim
D. Lower
2020 By Eng. Joud Khattab
221. Question 28
■ _____ operator is used for appending two strings
A. &
B. %
C. ||
D. _
2020 By Eng. Joud Khattab
222. Question 28
■ _____ operator is used for appending two strings
A. &
B. %
C. ||
D. _
2020 By Eng. Joud Khattab
223. Question 29
■ The union operation automatically __________ unlike the select clause
A. Adds tuples
B. Eliminates unique tuples
C. Adds common tuples
D. Eliminates duplicate
2020 By Eng. Joud Khattab
224. Question 29
■ The union operation automatically __________ unlike the select clause.
A. Adds tuples
B. Eliminates unique tuples
C. Adds common tuples
D. Eliminates duplicate
2020 By Eng. Joud Khattab
225. Question 30
■ The predicate in a where clause can involve Boolean operations such as and
■ The result of: true and unknown is _____
false and unknown is _____
unknown and unknown is _____
A. Unknown, unknown, false
B. True, false, unknown
C. True, unknown, unknown
D. Unknown, false, unknown
2020 By Eng. Joud Khattab
226. Question 30
■ The predicate in a where clause can involve Boolean operations such as and
■ The result of: true and unknown is _____
false and unknown is _____
unknown and unknown is _____
A. Unknown, unknown, false
B. True, false, unknown
C. True, unknown, unknown
D. Unknown, false, unknown
2020 By Eng. Joud Khattab
227. Question 31
■ Using the ______ clause retains only one copy of such identical tuples
A. Null
B. Unique
C. Not null
D. Distinct
2020 By Eng. Joud Khattab
228. Question 31
■ Using the ______ clause retains only one copy of such identical tuples
A. Null
B. Unique
C. Not null
D. Distinct
2020 By Eng. Joud Khattab
229. Question 32
■ In an employee table to include the attributes whose value always have some value
which of the following constraint must be used?
A. Null
B. Not null
C. Unique
D. Distinct
2020 By Eng. Joud Khattab
230. Question 32
■ In an employee table to include the attributes whose value always have some value
which of the following constraint must be used?
A. Null
B. Not null
C. Unique
D. Distinct
2020 By Eng. Joud Khattab
231. Question 33
■ Aggregate functions are functions that take a ___________ as input and return a
single value
A. Collection of values
B. Single value
C. Aggregate value
D. Both Collection of values & Single value
2020 By Eng. Joud Khattab
232. Question 33
■ Aggregate functions are functions that take a ___________ as input and return a
single value
A. Collection of values
B. Single value
C. Aggregate value
D. Both Collection of values & Single value
2020 By Eng. Joud Khattab
233. Question 34
■ All aggregate functions except _____ ignore null values in their input collection.
A. Count(attribute)
B. Count(*)
C. Avg
D. Sum
2020 By Eng. Joud Khattab
234. Question 34
■ All aggregate functions except _____ ignore null values in their input collection.
A. Count(attribute)
B. Count(*)
C. Avg
D. Sum
2020 By Eng. Joud Khattab
235. Question 35
■ Aggregate functions can be used in the select list or the _______ clause of a select
statement or subquery. They cannot be used in a ______ clause.
A. Where, having
B. Having, where
C. Group by, having
D. Group by, where
2020 By Eng. Joud Khattab
236. Question 35
■ Aggregate functions can be used in the select list or the _______ clause of a select
statement or subquery. They cannot be used in a ______ clause.
A. Where, having
B. Having, where
C. Group by, having
D. Group by, where
2020 By Eng. Joud Khattab
237. Question 36
■ Which one of the following deletes all the entries but keeps the structure of the
relation.
A. Delete from r where P;
B. Delete from instructor where dept name= ’Finance’;
C. Delete from instructor where salary between 13000 and 15000;
D. Delete from instructor;
2020 By Eng. Joud Khattab
238. Question 36
■ Which one of the following deletes all the entries but keeps the structure of the
relation.
A. Delete from r where P;
B. Delete from instructor where dept name= ’Finance’;
C. Delete from instructor where salary between 13000 and 15000;
D. Delete from instructor;
2020 By Eng. Joud Khattab
239. Question 37
■ UPDATE instructor _____ salary= salary * 1.05;
■ Fill in with correct keyword to update the instructor relation.
A. Where
B. Set
C. In
D. Select
2020 By Eng. Joud Khattab
240. Question 37
■ UPDATE instructor _____ salary= salary * 1.05;
■ Fill in with correct keyword to update the instructor relation.
A. Where
B. Set
C. In
D. Select
2020 By Eng. Joud Khattab
241. Question 38
■ Which of the join operations do not preserve non matched tuples?
A. Left outer join
B. Right outer join
C. Inner join
D. Natural join
2020 By Eng. Joud Khattab
242. Question 38
■ Which of the join operations do not preserve non matched tuples?
A. Left outer join
B. Right outer join
C. Inner join
D. Natural join
2020 By Eng. Joud Khattab
243. Question 39
■ How many tables may be included with a join?
A. One
B. Two
C. Three
D. All of the mentioned
2020 By Eng. Joud Khattab
244. Question 39
■ How many tables may be included with a join?
A. One
B. Two
C. Three
D. All of the mentioned
2020 By Eng. Joud Khattab
245. Question 40
■ Data integrity constraints are used to:
A. Control who is allowed access to the data
B. Ensure that duplicate records are not entered into the table
C. Improve the quality of data entered for a specific property
D. Prevent users from changing the values stored in the table
2020 By Eng. Joud Khattab
246. Question 40
■ Data integrity constraints are used to:
A. Control who is allowed access to the data
B. Ensure that duplicate records are not entered into the table
C. Improve the quality of data entered for a specific property
D. Prevent users from changing the values stored in the table
2020 By Eng. Joud Khattab
247. Question 41
■ In order to ensure that an instructor’s salary domain allows only values greater than
a specified value use:
A. Value>=30000.00
B. Not null;
C. Check(value >= 29000.00);
D. Check(value)
2020 By Eng. Joud Khattab
248. Question 41
■ In order to ensure that an instructor’s salary domain allows only values greater than
a specified value use:
A. Value>=30000.00
B. Not null;
C. Check(value >= 29000.00);
D. Check(value)
2020 By Eng. Joud Khattab
249. Question 42
■ Which of the following statement is used to remove the privilege from the user Amir?
A. Remove update on department from Amir
B. Revoke update on employee from Amir
C. Delete select on department from Raj
D. Grant update on employee from Amir
2020 By Eng. Joud Khattab
250. Question 42
■ Which of the following statement is used to remove the privilege from the user Amir?
A. Remove update on department from Amir
B. Revoke update on employee from Amir
C. Delete select on department from Raj
D. Grant update on employee from Amir
2020 By Eng. Joud Khattab
251. Question 43
■ Which of the following is another name for a weak entity?
A. Child
B. Owner
C. Dominant
D. All of the mentioned
2020 By Eng. Joud Khattab
252. Question 43
■ Which of the following is another name for a weak entity?
A. Child
B. Owner
C. Dominant
D. All of the mentioned
2020 By Eng. Joud Khattab
253. Question 44
■ In the __________ normal form, a composite attribute is converted to individual
attributes.
A. First
B. Second
C. Third
D. Fourth
2020 By Eng. Joud Khattab
254. Question 44
■ In the __________ normal form, a composite attribute is converted to individual
attributes.
A. First
B. Second
C. Third
D. Fourth
2020 By Eng. Joud Khattab
255. Question 45
■ The syntax of a user query is verified by:
A. Query optimizer
B. DBA
C. Parser
D. None of the above
2020 By Eng. Joud Khattab
256. Question 45
■ The syntax of a user query is verified by:
A. Query optimizer
B. DBA
C. Parser
D. None of the above
2020 By Eng. Joud Khattab
257. Question 46
■ DBA stands for:
A. Data Bank Access.
B. Database Access.
C. Data Bank Administration.
D. Database Administrator.
2020 By Eng. Joud Khattab
258. Question 46
■ DBA stands for:
A. Data Bank Access.
B. Database Access.
C. Data Bank Administration.
D. Database Administrator.
2020 By Eng. Joud Khattab
259. Question 47
■ E-R model uses which symbol to represent weak entity set :
A. Dotted rectangle
B. Diamond
C. Doubly outlined rectangle.
D. None of the above.
2020 By Eng. Joud Khattab
260. Question 47
■ E-R model uses which symbol to represent weak entity set :
A. Dotted rectangle
B. Diamond
C. Doubly outlined rectangle.
D. None of the above.
2020 By Eng. Joud Khattab
261. Question 48
■ The attributes made up of more than one single attributes are called :
A. Derived attribute
B. Composite attribute
C. Single value attribute
D. Multi value attribute
2020 By Eng. Joud Khattab
262. Question 48
■ The attributes made up of more than one single attributes are called :
A. Derived attribute
B. Composite attribute
C. Single value attribute
D. Multi value attribute
2020 By Eng. Joud Khattab
263. Question 49
■ What is the correct syntax of the declaration which defines the XML version?
A. <xml version="A.0" />
B. <?xml version="A.0"?>
C. <?xml version="A.0" />
D. None of the above
2020 By Eng. Joud Khattab
264. Question 49
■ What is the correct syntax of the declaration which defines the XML version?
A. <xml version="A.0" />
B. <?xml version="A.0"?>
C. <?xml version="A.0" />
D. None of the above
2020 By Eng. Joud Khattab
265. Question 50
■ Which of the following strings are a correct XML name?
A. xmlExtension
B. xslNewElement
C. XMLElement#123
D. All
2020 By Eng. Joud Khattab
266. Question 50
■ Which of the following strings are a correct XML name?
A. xmlExtension
B. xslNewElement
C. XMLElement#123
D. All
2020 By Eng. Joud Khattab
267. Question 51
■ Which clause from the following corresponds to the projection operation of the
relational algebra ?
A. From
B. Select
C. Where
D. Group by
2020 By Eng. Joud Khattab
268. Question 51
■ Which clause from the following corresponds to the projection operation of the
relational algebra ?
A. From
B. Select
C. Where
D. Group by
2020 By Eng. Joud Khattab