Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 3630 Database Design and Implementation. Null Value The value of an attribute could be NULL NOT known at the moment or NOT Applicable Example Cell.

Similar presentations


Presentation on theme: "CS 3630 Database Design and Implementation. Null Value The value of an attribute could be NULL NOT known at the moment or NOT Applicable Example Cell."— Presentation transcript:

1 CS 3630 Database Design and Implementation

2 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 2

3 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 3

4 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. Primary Key: The selected candidate key 4

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

6 FK of Staff: Bno references Branch Which branch is SG100 in? Which branch is SG363 in? 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 6

7 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 7

8 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 Stored Procedures Trigger 8

9 Relational Integrity Entity Integrity PK Referential Integrity FK Enterprise Constraints More rules 9

10 Schedule Today Assignment6-1 Friday Quiz2 Assignment6-2 Wednesday, March 11 Test1 10

11 Quiz 2 (25 points) Friday, March 6 Lab 206 Using Computers D2L: download and upload file Derive table schemas from E-R Model (Mapping E-R Model to Database Schema) DBDL Functional Dependency Note11 – Note14 Assignment 4, 5-1 and 6-1 11

12 Assignment5-2 12


Download ppt "CS 3630 Database Design and Implementation. Null Value The value of an attribute could be NULL NOT known at the moment or NOT Applicable Example Cell."

Similar presentations


Ads by Google