Database Design I (In-Class Exercise Answer) IST 210: Organization of Data IST2101
In-class Exercise 1 IST2102 Transform this diagram into tables UserID Name SpotID Location MonthlyCost USER PARKING PARKING(SpotID, Location, MonthlyCost) USER(UserID, Name, , SpotID) PARKING(SpotID, Location, MonthlyCost, UserID) USER(UserID, Name, ) Note: both options are correct, but the first one is preferred because of the minimal cardinality of SpotID is mandatory.
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
In-class Exercise 3 IST2104 CourseID CourseName Instructor StudentID StudentName COURSE STUDENT Transform this diagram into tables STUDENT(StudentID, StudentName, ) COURSE(CourseID, CourseName, Instructor) REGISTRATION(StudentID, CourseID) Notes: In REGISTRATION table, StudetID and CourseID are both primary key and foreign key.