October 6 University Faculty of Information System & Computer Science Department: IS/CS Study Year/Level: Fourth Course Title: Advanced Database Course Code: 424 Examination Date: 06/04/ 2017 Examination Starts: Morning Allowed Examination time: 1 hours Total Marks: 30 Marks The Examination Consists of Six Questions in Two Pages Answer all the following questions PART A- (2 x 3 = 6 marks) 1. What is the difference between primary and foreign keys? The primary is unique, but the foreign my be repeated. The primary can't be null, but the foreign my be null. 2. What is the difference between BCNF and third normal forms? In third normal form, if X → Y, then X is a super key or Y is a prime. In BCNF, if X → Y, then X is a super key. 3. What is the IS-A relationship? It's a relationship between a class and its subclass. PART B – ( 24 marks) 4. Consider the BANK schema in the figure below and suppose that it is necessary to keep track of different types of ACCOUNTS (SAVINGS_ACCTS, CHECKING_ACCTS, ...) and LOANS (CAR_LOANS, HOME_LOANS, ...). Suppose that it is also desirable to keep track of each ACCOUNT’s TRANSACTIONS (deposits, withdrawals, checks, ...) and each LOAN’s PAYMENTS; both of these include the amount, date, and time. Modify the BANK schema, using EER concepts of specialization. Page 1 of (3) (10 marks) Answer: 5. Consider a relation BOOK (Book_title, Authorname, Booktvpe, price, Author_affil, Publisher). Suppose the following dependencies exist: Book_title → Publisher, Book_type. Book_type → price. Authorname → Author_affil. a. What normal form is the relation in? Explain your answer. Page 2 of (3) b. Apply normalization until you cannot decompose the relations further. State the reasons behind each decomposition. (10 marks) Answer: (a)The key for this relation is Book_title,Authorname. This relation is in 1NF and not in 2NF as no attributes are FFD on the key. It is also not in 3NF. (b) 2NF decomposition: Book0(Book_title, Authorname) Book1(Book_title, Publisher, Book_type, Listprice) Book2(Authorname, Author_affil) This decomposition eliminates the partial dependencies. 3NF decomposition: Book0(Book_title, Authorname) Book1-1(Book_title, Publisher, Book_type) Book1-2(Book_type, Listprice) Book2(Authorname, Author_affil) 6. Consider the following relations for a database that keeps track of student enrolment in courses and the books adopted for each course and Specify the foreign keys for this schema STUDENT (Ssn, Name, Major, Bdate) COURSE (Course#, Cname, Dept) ENROLL (Ssn, Course#, Quarter, Grade) BOOK_ADOPTION (Course#, Quarter, Book_isbn) TEXT (Book isbn, Book_title, Publisher, Author) Answer (4 marks) The schema of this question has the following four foreign keys: 3. the attribute SSN of relation ENROLL that references relation STUDENT, 4. the attribute Course# in relation ENROLL that references relation COURSE, 5. the attribute Course# in relation BOOK_ADOPTION that references relation COURSE, and 6. the attribute Book_ISBN of relation BOOK_ADOPTION that references relation TEXT. With my best wishes Dr. Abd El-Aziz Ahmed Page 3 of (3)
© Copyright 2024 Paperzz