Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assignment6-1 Assignment6-2 Due Wednesday, March 13 1.

Similar presentations


Presentation on theme: "Assignment6-1 Assignment6-2 Due Wednesday, March 13 1."— Presentation transcript:

1 Assignment6-1 Assignment6-2 Due Wednesday, March 13 1

2 Relational Integrity Entity Integrity Referential Integrity Enterprise Constraints 2

3 Null Value The value of an attribute could be NULL NOT known at the moment or NOT Applicable Example Cell Phone number BranchNo in Staff table if BranchNo is not required for all staff 3

4 RDBMS Relational DBMS should be able to handle NULL values. One issue Null = Null? List all staff who have not been assigned to a branch yet. BranchNo = Null -- Will not work BranchNo is null - This will work 4

5 Entity Integrity In a base relation, no attribute of the primary key can be NULL. Candidate Key: Minimum set of attributes to uniquely identify records. 5

6 Referential Integrity Foreign key Must match a primary key in the parent relation Or Wholly NULL For any table instance! 6

7 FK of Staff: Bno references Branch Which branch is SA200 in? Foreign key Must match a primary key in the parent relation, or Wholly NULL SG363 is OK: has not been signed to a branch yet Branch BnoPhone… B101 B205 Staff SnoPhoneBno SG100B101 SG363Null SA200B000 7

8 FK of Booking: (HotelNo, RoomNo) Which hotel is booking 001 for? Which room is booking 002 for? Foreign key Must match a primary key in the parent relation, or (Wholly NULL) Room HotelnoRoomNo… H101R001 H101R009 H109R001 Booking HotelNoRoomNoBookingNoGuestNo NullR001 001G100 H101Null 002G200 H101R001 003G200 8

9 Enterprise Constraints Business rules need to be enforced in database Functional Dependency Domain for each attribute HotelRoom (HotelNo, RoomNo…Type…) Type is a string, but three possible values: Family, Double, Single Trigger 9

10 Schedule Friday No Class Monday, March 11 Quiz2 Wednesday, March 13 Assignment6-2 Wednesday, March 20 Test1 10

11 Quiz 2 (25 points) Monday, March 11 Lab 206 Using Computers and Drop Files Derive table schemas from E-R Model (Mapping E-R Model to Database Schema) DBDL Functional Dependency Note11 – Note15 Assignment 4, 5-1 and 6-1 11


Download ppt "Assignment6-1 Assignment6-2 Due Wednesday, March 13 1."

Similar presentations


Ads by Google