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

Consider the following relational schema, DDL statements and tables. Show the st

ID: 3748971 • Letter: C

Question

Consider the following relational schema, DDL statements and tables. Show the status of the above tables after each of the following operations:

Inserting a new employee: 30, F, 6, 9 into the Table EMPLOYEE. If it is rejected, explain

EMPLOYEE( EmployeeID, EmployeeName, SupervisorID, Department ID)

PROJECT (ProjectID, EmployeeID)

DEPARTMENT( Department ID, DepartmentName)

CREATE TABLE EMPLOYEE

( EmployeeID          INT PRIMARY KEY,

  EmployeeName   VARCHAR(50) NOT NULL,

  SupervisorID INT DEFAULT 9,

  DepartmentID   INT,

  FOREIGN KEY (SupervisorID) REFERENCES EMPLOYEE (EmployeeID)

  ON DELETE SET NULL ON UPDATE SET DEFAULT

);

CREATE TABLE PROJECT (

ProjectID    INT PRIMARY KEY,

EmployeeID INT DEFAULT 9,

FOREIGN KEY (EmployeeID) REFERENCES EMPLOYEE (EmployeeID)

  ON DELETE SET NULL   );

CREATE TABLE DEPARTMENT(

DepartmentID INT PRIMARY KEY,

DepartmentName   VARCHAR(50)

);

EMPLOYEE EmployeeID EmployeeName SupervisorID DepartmentID NULL PROJECT ProjectID EmployeeID DEPARTMENT DepartmentID DepartmentName

Explanation / Answer

If you have any doubts, please give me comment...

INSERT INTO EMPLOYEE VALUES(30, 'F', 6, 9);

By executing this query, you will get error because of foreign key constraint fails. We don't have department ID with 9 in Department table.