1. (15 points) Identify the primary key and foreign key for the relations below.
ID: 3887888 • Letter: 1
Question
1. (15 points) Identify the primary key and foreign key for the relations below. A database for DSU (Database State University) contains information about professors (identified by ProflD), Students (identified by StudentID) and courses (identified by Courseld). The database also stores students' grade info as well as professors' office info·The database assumes that each professor has only one office, and up-to three professors can share a room (office). Professor (ProfID, FirstName, LastName, Building Name, OfficelD, Email) Student (StudentID, FirstName, LastName, Email) Course (CourselD, Course Title, Term, Year, Description) Grade (StudentID, CourseID, LetterGrade Office (OfficelD, OfficePhoneNumber, BuildingName, RoomNumber, Floor) Table -_-Primary Key Foreign Key Table Referenced Professor Course Student Grade OfficeExplanation / Answer
Most of the Primary Keys is self explanatory, except for Grade, We are giving 2 columns to be its Primary key as both of those column names are primary keys of some other table hence we combined i.e. StudentID+CourseID as the primary key since it should be unique in the table without any redundance of the data and NOT NULL constraint.
Now coming to the Foreign keys, It is straight forward for most of the things except for Grade and Office tables, It is because there are no reference columns as we see for other tables for example Professor has OfficeID as foreign key which is a primary key to the Office Table.
Thanks for the question , Please let me know if you have any queries will be glad to help.
Table PK FK Table Referenced Professor ProfID OfficeID Office Course CourseID CourseID Grade Student StudentID StudentID Grade Grade StudentID+CourseID NA NA Office OfficeID NA NARelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.