QA Chapter5
QA Chapter5
QA Chapter5
Multiple-Choice Questions:
1) The relational model represents the database as a collection of ______.
a) files b) relations c) applications d) systems
4) The data type of values that appear in each column is represented by _____ of possible values.
a) range b) product c) domain d) function
13) _______ constraint can be expressed in schema of relational model by using DDL.
a) schema-based b) inherent model-based c) application-based d) system-based
14) ________ constraint specifies that no two distinct tuples in any state of relational schema can
have same values for superkeys.
a) entity-integrity b) domain c) referential-integrity d) key
15) _______ constraint specifies that within each tuple, the value of each attribute must be atomic
value from some domain.
a) entity-integrity b) domain c) referential-integrity d) key
17) When there is more than one key in a relation, then each such key is called ______.
a) primary b) useful c) multiple d) candidate
18) _______ constraint states that no primary key value can be null.
a) key b) domain c) referential-integrity d) entity-integrity
19) _______ constraint states that a tuple in one relation that refers to another relation must refer to
an existing tuple in that relation.
a) key b) domain c) referential-integrity d) entity-integrity
20) _______ constraint is used to maintain consistency among tuples in two relations.
a) key b) domain c) referential-integrity d) entity-integrity
TRUE or FALSE:
1. All values in a column are of same data type. (T/F)
2. Each row in a table represents a collection of different data values. (T/F)
3. In formal relational model terminology, a table is called a relation. (T/F)
4. A domain is a set of composite values. (T/F)
5. A domain need not be given a format. (T/F)
6. It is possible for several attributes to have same domain. (T/F)
7. Tuples in a relation must have a particular order. (T/F)
8. Ordering of values in a tuple is important. (T/F)
9. Composite or multivalued attributes are allowed in relational model. (T/F)
10. A relation schema can have more than one key. (T/F)
11. A key can have redundant attributes. (T/F)
12. A superkey can have redundant attributes. (T/F)
13. The underlined attribute in ER diagram represents a primary key. (T/F)
14. It is better to have a primary key that has as many attributes as possible. (T/F)
15. Key and entity-integrity constraint are specified on more than one relation. (T/F)
16. The referential-integrity constraint is specified between two relations. (T/F)
17. A foreign key can have a null value. (T/F)
18. A foreign key can refer to its own relation. (T/F)
19. Insert operation cannot violate domain constraint. (T/F)
20. Delete operation can violate all constraints. (T/F)
LIBRARY DATABASE
BOOK BOOK_AUTHORS
Book Book ID Author Name
Book Title Publisher Name
ID 112233 El-Masri
112233 Data Base Systems Addison Wesley 113344 Tanenbaum
113344 Computer Networks Addison Wesley 114455 El-Masri
114455 Computer Networks McGraw Hill 223344 Tanenbaum
223344 Data Base Systems McGraw Hill 225577 Mano
225577 Computer Architecture Addison Wesley 331199 John
331199 MS Office Addison Wesley 334455 El-Masri
334455 Operating Systems Addison Wesley 445566 Tanenbaum
445566 Operating Systems McGraw Hill 556677 Mano
556677 Operating Systems Prentice Hall 661199 John
661199 MS Word Prentice Hall 663300 El-Masri
663300 Logic Design Prentice Hall 773311 Ahmed
773311 JAVA Prentice Hall 773355 El-Masri
773355 Programming Languages McGraw Hill 881100 Schildt
881100 Visual Basic Addison Wesley 881166 Aho
881166 JAVA McGraw Hill 881188 Mano
881188 Logic Design McGraw Hill 991100 Ramesh
991100 MS Office Prentice Hall 994466 Aho
994466 C/C++ Addison Wesley
BOOK_COPIES BOOK_LOANS
Book ID Branch ID Number of Copies Book Branch Card Date Date of
112233 111111 3 ID ID Number Loaned Return
113344 222222 4 112233 111111 567890 6/1/2005 8/1/2005
114455 333333 3 113344 333333 234567 6/2/2005 8/2/2005
223344 111111 5 114455 222222 345678 6/1/2005 8/1/2005
225577 333333 1 223344 333333 456789 4/8/2005 6/8/2005
331199 111111 3 225577 333333 567890 6/4/2005 8/4/2005
334455 111111 6 331199 111111 678901 1/1/2005 3/1/2005
445566 333333 15 445566 333333 890123 4/4/2005 6/4/2005
556677 222222 22 556677 111111 901234 2/1/2005 4/1/2005
661199 111111 20 661199 111111 223456 6/1/2005 8/1/2005
663300 222222 5 773355 111111 667890 6/2/2005 8/2/2005
773311 111111 5 881166 222222 556789 1/1/2001 3/1/2001
773355 444444 6 881188 222222 223456 2/2/2004 4/2/2004
881100 333333 20 991100 111111 901234 1/1/2005 3/1/2005
881166 222222 35 994466 444444 456789 6/1/2003 8/1/2003
881188 444444 45
991100 222222 25
994466 333333 20
BORROWER PUBLISHER
Phone Publisher Name Address Phone
Card Name of Address of
Number of Addison Wesley 3000, West End, 303030333
Number Borrower Borrower
Borrower Singapore
111234 Aiman 1122, Street 666 5457 McGraw Hill 2000, Connaught Place, 202020222
19, Jeddah Delhi
112345 Abdul 1120, Street 999 7654 Prentice Hall 1000, Arlington Street, 101010111
10, Riyadh Michigan
123456 Ahmed 1020, Street 222 4567
1, Hayel
222345 Hussain 2233, Street 888 6556
20, Riyadh
223456 Mubarak 2230, Street 777 4567
11, Jeddah
234567 Mohammed 2030, Street 555 6789 LIBRARY_BRANCH
2, Jeddah Branch ID Branch Name Address
334567 Saad 3340, Street 999 5643 111111 North 111, North End
12, Riyadh 222222 South 222, South End
345678 Jabbar 3040, Street 888 5432 333333 East 333, East End
3, Riyadh
444444 West 444, West End
445678 Mohsin 4450, Street 444 6789
13, Jeddah
456789 Salem 4050, Street 333 7645
4, Dammam
556789 Moosa 5560, Street 111 4567
14,
Dammam
567890 Salman 5060, Street 777 4356
5, Riyadh
667890 Fahd 6670, Street 666 5678
15, Khobar
678901 Zayed 6070, Street 777 4567
6, Jeddah
778901 Khaled 7780, Street 777 5443
16, Riyadh
789012 Osama 7080, Street 999 6434
7, Makkah
889012 Aziz 8890, Street 777 5678
17, Jeddah
890123 Ismail 8090, Street 111 2346
8, Madinah
901234 Lateef 9010, Street 777 5432
9, Riyadh
990123 Taleb 9910, Street 222 4567
18, Riyadh
Suppose each of the following update operations is applied directly to the LIBRARY database
state. Discuss all integrity constraints violated by each operation, if any.
BOOK_AUTHORS
BOOK_COPIES
Book ID Branch ID Number of Copies
BOOK_LOANS
Book ID Branch ID Card Number Date Loaned Date of Return
BORROWER
PUBLISHER
LIBRARY_BRANCH
1. Insert <‘Robert’, ‘F’, ‘Scott’, ‘943775543’, ‘1952-06-21’, ‘2365 Newcastle Rd, Bellaire,
TX’, M, 58000, ‘888665555’, 1> into EMPLOYEE.
2. Insert <‘Product A’, 4, ‘Bellaire’, 2> into PROJECT.
3. Insert <‘Production’, 4, ‘943775543’, ‘1998-02-01’> into DEPARTMENT.
4. Insert <‘677678989’, null, ’40.0’> into WORKS_ON.
5. Insert <‘453453453’, ‘John’, M, ‘1970-02-03’, ‘SPOUSE’> into DEPENDENT.
6. Delete the WORKS_ON tuples with ESSN = ‘333445555’.
7. Delete the EMPLOYEE tuple with SSN = ‘9887654321’.
8. Delete the PROJECT tuple with PNAME = ‘ProductX’.
9. Modify the MGRSSN and MGRSTARTDATE of the DEPARTMENT tuple with
DNUMBER = 5 to ‘123456789’ and ‘1999-10-01’, respectively.
10. Modify the SUPERSSN attribute of the EMPLOYEE tuple with SSN = ‘999887777’ to
‘94377543’.
11. Modify the HOURS attribute of the WORKS_ON tuple with ESSN = ‘999887777’ and
PNO = 10 to ‘5.0’.