Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design I (In-Class Exercise Answer) IST 210: Organization of Data IST2101.

Similar presentations


Presentation on theme: "Database Design I (In-Class Exercise Answer) IST 210: Organization of Data IST2101."— Presentation transcript:

1 Database Design I (In-Class Exercise Answer) IST 210: Organization of Data IST2101

2 In-class Exercise 1 IST2102 Transform this diagram into tables UserID Name Email SpotID Location MonthlyCost USER PARKING PARKING(SpotID, Location, MonthlyCost) USER(UserID, Name, Email, SpotID) PARKING(SpotID, Location, MonthlyCost, UserID) USER(UserID, Name, Email) Note: both options are correct, but the first one is preferred because of the minimal cardinality of SpotID is mandatory.

3 In-class Exercise 2 IST2103 Transform this diagram into tables BUILDING(BuildingName, Address) APARTMENT(BuildingName, ApartmentID, NumberOfBedrooms, NumberofBaths, Rent) Notes: A common mistake is making ApartmentID as the single primary key. (BuildingName, ApartmentID) should be a composite primary key for APARTMENT Another common mistake is to create a duplicate attribute BuildingName in APARTMENT as the foreign key, or forget to make BuildingName as the foreign key

4 In-class Exercise 3 IST2104 CourseID CourseName Instructor StudentID StudentName Email COURSE STUDENT Transform this diagram into tables STUDENT(StudentID, StudentName, Email) COURSE(CourseID, CourseName, Instructor) REGISTRATION(StudentID, CourseID) Notes: In REGISTRATION table, StudetID and CourseID are both primary key and foreign key.


Download ppt "Database Design I (In-Class Exercise Answer) IST 210: Organization of Data IST2101."

Similar presentations


Ads by Google