SLIDE 4 10 10
KEY CONSTRAINTS
2 choices Map relationship set to a table
Separate tables for Employees and Departments. Note that did is the key now!
Since each department has a unique manager, we could
instead combine Manages and Departments.
11 11
KEY CONSTRAINTS
Choice 1 Map relationship set to a table
Separate tables for Employees and Departments. Note that did is the key now! CREATE TABLE Manages(
ssn CHAR(11), did INTEGER, since DATE,
PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees, FOREIGN KEY (did) REFERENCES Departments)
ER Diagram Relational SQL 12 12
KEY CONSTRAINTS
Choice 2 Since each department has a unique
manager
Combine Manages and Departments!!
ER Diagram SQL since
CREATE TABLE Dept_Mgr(
did INTEGER, dname CHAR(20), budget REAL, ssn CHAR(11), since DATE,
PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees)
Relational