Download presentation
Presentation is loading. Please wait.
Published byAlice Thomas Modified over 9 years ago
1
1 CS 3630 Database Design and Implementation
2
2 Sets Foundation of relational database. Basic Operations Power set Mapping
3
3 Relational Algebra Operations Selection Projection (Union) (Set difference) (Intersection) Cartesian product Join Natural Join Outer Join
4
4 Relational Algebra Operations Apply to relation/table instances The result is still a relation/table instance Syntax
5
5 Relational Algebra Operations Which tables? Which operations? Which common attribute for join? Which attributes to retrieve?
6
6 (Guest Booking Hotel) Guest.* (fromDate = CurrentDate and hotelName = ‘Grosvenor’)
7
7 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 Normalization 3.Physical database design
8
8 E-R Model Entity Attributes: Simple or Composite Single-value or Multi-value Required or optional Relationship One-to-One One-to-Many Many-to-Many Could have attributes
9
9 Multiplicity For one object on the other side! E1 (1..1) IsRelatedTo (0..1) E2 E1 (0..*) IsRelatedTo (1..1) E2 E1 (0..*) IsRelatedTo (1..*) E2 Staff (1..*) IsRelatedTo (0..1) Branch Renter (0..*) Views (0..*) Property Date, Comment
10
10 Mapping Entity Composite Attribute Do we need a new table? NO! Multi-value Attribute Do we need a new table? YES!
11
11 Mapping Relationships One-to-Many Do we need a new table? NO! One-to-One Do we need a new table? NO! Many-to-Many Do we need a new table? YES!
12
12 Table Table Schema Definition DBDL Do not change too often Table Instance Records stored in database Different at different times Candidate keys
13
13 Candidate Key A minimum set of attributes that uniquely identifies each record of a table. No proper subset satisfying the definition. R (Att1, Att2, Att3) Candidate Keys: (Att1, Att2) Either Att1 or Att2 is not a candidate key But Att3 could be a candidate key
14
14 Candidate Key A minimum set of attributes that uniquely identifies each record of a table. No proper subset satisfying the definition. R (Att1, Att2, Att3, Att4) Candidate Keys: (Att1, Att2) Att3 Functional Dependency Att3 All other attributes Att1, Att2 All other attributes Att1 All other attributes Not True Att2 All other attributes Not True
15
15 Candidate Key, PK, AK and FK A table could have more than one candidate key. One candidate key is selected as the primary key (PK). Other candidate keys become alternate keys (AK). PK can be copied to other tables as foreign keys (FK).
16
16 Functional Dependency Definition In a relation/table R S: a set of attributes T: a set of attributes S T For ANY relation instance If two records of R have the same values on S Then they will have the same values on T Trivial FDs A A A, B, C B, C
17
First Normal Form (1NF) No multi-value attributes Done when mapping E-R model to relational schema 17
18
Second Normal Form (2NF) A relation R is in 1NF, and every non-primary-key attribute is fully functionally dependent on the primary key Then R is in 2NF. No Partial FD on PK. 18
19
Third Normal Form (3NF) Relation R in 2NF, and No non-Primary-Key attribute is transitively functionally dependent on the primary key Then R is in 3NF. No Transitive FD on PK. Must be in 2NF! 19
20
Boyce-Codd Normal Form (BCNF) Definition R in 1NF and Every determinant (the left side of a FD) is a candidate key. Stronger than 3NF! 20
21
Test 1: 50 Points Wednesday Lab 206 Sets Relational Database Model Relational Algebra Mapping E-R model to table schema Functional Dependency Normalization Open Book, Notes, Computer Copy-paste word document 21
22
Quiz2 22
23
Assignment6-2 23
24
Schedule Wednesday Test1 Friday Assignment7 (Due 5 pm Friday) 24
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.