Assignment 5-1 Functional Dependencies Attributes within one table True for all table instances Part of table schema (Assumptions) Cannot get FDs just from one table instance Not normalization yet
Assumptions NIN, hNo, and ContractNo are unique for Staff, Hotel, and Contract, respectively. hLoc is the city where a hotel is located. Several hotels may be in the same city. One hotel could have several contracts. One contract is for one hotel. Several staff may work on one contract. One staff may work on several contracts on the same hotel. hours is the total hours of one staff on one contract. More than one employee could have the same name.
eName NIN NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1135 C Smith J H4 Glasgow ….. ……... ……… …. …………… C Smith J H25 East Kilbride Incorrect: eName NIN (More than one employee could have the same name.) Correct: NIN eName (NIN is unique for Staff)
NIN All NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1135 C Smith J H4 Glasgow ….. ……... ……… …. …………… C Smith J H25 East Kilbride Incorrect: NIN All Incorrect: NIN hours Incorrect: NIN hNo (One staff may work on several contracts on the same hotel)
NIN, hNo All NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1135 C Smith J H4 Glasgow ….. ……... ……… …. …………… C Smith J H25 East Kilbride Incorrect: NIN, hNo All (One staff may work on several contracts on the same hotel) Incorrect: NIN, hLoc All
ContractNo, hNo All NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1057 C Hocine D H25 East Kilbride 1068 C White T H4 Glasgow 1135 C Smith J H4 Glasgow ….. ……... ……… …. ……………. Incorrect: ContractNo, hNo All (Several staff may work on one contract) hNo not needed anyway: ContractNo All Incorrect: ContractNo, hLoc All
ContractNo eName NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1057 C Hocine D H25 East Kilbride 1068 C White T H4 Glasgow 1135 C Smith J H4 Glasgow ….. ……... ……… …. ……………. Incorrect: ContractNo eName (Several staff may work on one contract) Incorrect: ContractNo hours
hNo ContractNo NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1057 C Hocine D H25 East Kilbride 1068 C White T H4 Glasgow 1135 C Smith J H4 Glasgow ….. ……... ……… …. …………… C Smith J H4 Glasgow Incorrect: hNo ContractNo (One hotel could have several contracts)
hLoc hNo NIN contractNo hours eName hNo hLoc 1135 C Smith J H25 East Kilbride 1057 C Hocine D H25 East Kilbride 1068 C White T H4 Glasgow 1135 C Smith J H4 Glasgow ….. ……... ……… …. …………… C Smith J H14 Glasgow Incorrect: hLoc hNo (hLoc is the city where a hotel is located) (Several hotels may be in the same city)
NIN eName contractNo hNo hNo hLoc NIN, contractNo hours NIN, contractNo hours, eName, hNo, hLoc NIN, contractNo All
1.Assumptions 2.Identify all non-trivial FDs NIN eName contractNo hNo hNo hLoc NIN, contractNo hours ( NIN, contractNo All) 3.Choose a PK: NIN, contractNo 4.List all AKs: NONE
Assignment 6-1 Schedule(staffNo, dentistName, patNo, patName, surgeryNo, Date, Time) Make assumptions: staffNo, patNo, and surgeryNo are unique. (for what?) SurgeryNo is the surgery room number. Date and Time are two different attributes. No Appointment! A patient is allowed to have more than one surgery a day. Only one surgery can take place in a room at any given time. A dentist can perform only one surgery at any given time. A dentist is allocated in one surgery room each day. But a surgery room can be used by multiple dentists on the same day. Due Monday 12