Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q3. Review the following CREATE Table commands. 15 CREATE TABLE Employees (ssn C

ID: 3756231 • Letter: Q

Question


Q3. Review the following CREATE Table commands. 15 CREATE TABLE Employees (ssn CHAR(11), name CHAR(30) lot INTEGER PRIMARY KEY (ssn)) CREATE TABLE Works_In2 (ssn CHAR(11), did INTEGER address CHAR(2O) since DATE, PRIMARY KEY (ssn, did, address), REFERENCES Employees, REFERENCES Locations REFERENCES Departments) FOREIGN KEY (ssn) FOREIGN KEY (address) FOREIGN KEY (did) 1. What is a Foreign Key? (7) 2. Why is attribute 'did' in Relation Works_In2 stated as a component of primary key and foreign key? (9) 3. Why is the Primary Key of Relation Works_In2 a composite-key? (9)

Explanation / Answer

Answer)

1. A foreign key is a field in a table of columns and rows in a database that uniquely identifies a row of another table, that is the table it references or even the same table's another field.

2. did is the Foreign key in the Works_In2 table, which references the did in the Departments table.

{ssn, did, address} is a composite primary key which uniquely identifies a row in the table Works_In2.

did is the primary key in the Departments table.

3. {ssn, did, address} is a composite primary key which uniquely identifies a row in the table Works_In2.

ssn is a foreign key which references the Employees ssn.

did is the Foreign key in the Works_In2 table which references the Departments did.

{ssn, did, address} is used to identify a unique row.

Thus, {ssn, did, address} is a composite primary key in Works_In2.