Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CS 3630 Database Design and Implementation. 2 Final Exam 7:00 – 8:52 PM, Thursday, May 16 Section 1: Ull 009 Section 2: Ull 206 100 Points –50 points.

Similar presentations


Presentation on theme: "1 CS 3630 Database Design and Implementation. 2 Final Exam 7:00 – 8:52 PM, Thursday, May 16 Section 1: Ull 009 Section 2: Ull 206 100 Points –50 points."— Presentation transcript:

1 1 CS 3630 Database Design and Implementation

2 2 Final Exam 7:00 – 8:52 PM, Thursday, May 16 Section 1: Ull 009 Section 2: Ull 206 100 Points –50 points on design –50 points on SQL Open Book/Note/Computer Do it yourself

3 Set Theory 3

4 Relational Algebra Selection :  (predicate) (R) Projection :  Att1, Att3 (R) Cartesian Product: R  S Theta Join : R p S Natural Join :R S Out Join : R S 4

5 5 Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the process of design. Three main phases 1.Conceptual database design E-R Model 2.Logical database design Mapping E-R Model to (relational) database schema (DBDL) Normalization 3.Physical database design

6 6 Mapping Entity Multi-value and Composite Attribute Student studentNo Name: Composite (first, last) CoursesTaken: Multi-Value... Table Schema Student (studentNo, firstName, lastName...) AcademicProg(studentNo, CourseID) (one student will have multiple records in the table)

7 7 Mapping Relationships EntityOne (1) ----- Related ----- (0..*) EntityTwo Owner (1) ----- Owns ----- (0..*) Property One-to-Many Parent table: EntityOne / Owner Copy PK of parent table into child table as FK EntityThree (0..*) ----- Related ----- (1..*) EntityFour Staff (1..*) ----- AssignedTo ----- (0..*) Ward Many-to-Many Create a new table One-to-One

8 8 Mapping Relationships Entity3 (0..*) ----- Related ----- (1..*) Entity4 Att1, Att2 Entity3 (A1, A2, A3) Entity4 (B1, B2, B3, B4) NewTable (A1, B1, B2, Att1, Att2, NewAtt) PK: NewAtt AK: ? FK: A1 References Entity3 B1, B2 References Entity4

9 9 How to Describe a Table Schema? Database Design Language (DBDL) Branch (Bno, Street, City, State, Zipcode, Phone) PK: Bno AK: Street, City, Zipcode Phone FK: None Staff (Sno, firstName, lastName, Address, Bno ) PK: Sno AK: None FK: Bno references Branch Client (Cno, firstName, lastName, Phone, MaxRent, PrefType) PK: Cno AK: None FK: None Viewing (Rno, Pno, ViewDate, Comment) PK: Rno, Pno, Vie wDate AK: None FK: Rno references Client (Cno) Pno references Property No multi-value attributes, no composite attributes. 1NF

10 10 Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the process of design. Three main phases 1.Conceptual database design E-R (EER) Model 2.Logical database design Mapping E-R Model to (relational) database schema (Derive table / database schema) Normalization 3.Physical database design

11 11 Normalization Why? Functional Dependency 1NF 2NF 3NF BCNF DBDL for schema Instance to show records

12 R1 (A, C) Primary Key: A Alternate Key: None Foreign Key: None A ---> C R2 (B, E, F) Primary Key: B Alternate Key: None Foreign Key: None B ---> E, F R3 (A, B, D) Primary Key: A, B Alternate Key: None Foreign Key: A References R1 B References R2 A, B ---> D 12 R (A, B, C, D, E, F) Functional Dependencies: A, B ---> All A ---> C B ---> E, F Decompose table R into BCNF

13 Table Instance R A B C D E F 1 x 10 100 cs se 1 y 10 200 cs ee 2 x 20 300 cs se 2 y 20 400 cs ee R1 A C 1 10 2 20 R2 B E F x cs se y cs ee R3 A B D 1 x 100 1 y 200 2 x 300 2 y 400 13

14 14 Database Queries Tables needed Join condition Group By Outer Join and Sub-Query All clients without class today


Download ppt "1 CS 3630 Database Design and Implementation. 2 Final Exam 7:00 – 8:52 PM, Thursday, May 16 Section 1: Ull 009 Section 2: Ull 206 100 Points –50 points."

Similar presentations


Ads by Google