Information and Computer Science Department Fall Semester 071 ICS 324 – Database Systems Sections 2 & 3 Major Exam 1 Saturday, November 10, 2007 Time: 90 minutes Name: ID#: Grade / 90 Question # 1 [6 + 2 + 2 points] A) Given an application to develop, how to decide whether to use database approach or not? B) What is the goal of the three-schema architecture? C) What is the difference between two-tier and three-tier architectures? Question # 2 [10 points] Find all candidate (possible) keys for the following relation: A 10 10 11 12 13 14 B b1 b2 b4 b3 b1 b3 C c1 c2 c1 c4 c1 c4 TUPLE# #1 #2 #3 #4 #5 #6 ICS324 Question # 3 [20 points] Given the following relations: Major Exam 1 SUPPLIER Page # 2 out of 4 PART SUPPLY SN SNAME CITY PN PNAME SN PN QTY S1 AHMED DAMMAM P1 NUT S1 P1 300 S2 ALI JEDDAH P2 BOLT S1 P2 200 S3 KHALID JEDDAH P3 SCREW S1 P3 400 S4 SALEM RIYADH P4 SCREW S1 P4 200 S5 OMAR MAKKAH P5 CAM S1 P5 100 S2 P1 300 S3 P2 200 S4 P2 200 S4 P4 300 S4 P5 100 Find the result of the following relational algebra expressions: 1) ( 2) SN SUPPLIER.CITY=’DAMMAM’ SUM QTY (SUPPLIER)) * SUPPLY (SUPPLY) 3) ( SN, PN SUPPLY) ÷ ( PN PART) 4) SUPPLIER SUPPLIER.SN=SUPPLY.SN SUPPLY ICS324 Major Exam 1 Question # 4 [10 points] Specify the following queries in relational algebra using the relations of question 3: 5) Retrieve the part number, name and the quantity for each part. Page # 3 out of 4 6) Retrieve the part numbers that are supplied by all suppliers. Question # 5 [10 points] Specify the following query in both tuple and domain relational calculus using the relations of question 3: Retrieve the parts that are supplied by supplier ‘S4’. 1) Tuple relational calculus 2) Domain relational calculus ICS324 Major Exam 1 Page # 4 out of 4 Question # 6 [30 points] Specify the following queries in SQL using the relations of question 3: 1) Create a new table that has two attributes; PN and QTY where PN is the primary key and at the same time a foreign key that refers to PN of table PART. 2) Insert the data into the new table using a query. 3) For each part, retrieve the part number and how many suppliers are supplying it. 4) Retrieve the supplier number that supplies the largest quantity. 5) Retrieve the numbers of suppliers supplying no parts.