Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the SQL Code to insert the data for each of the tables in the database provided in the pictures. I will provide the SQL
Create the SQL Code to insert the data for each of the tables in the database provided in the pictures. I will provide the SQL code used to create the tables as well in case its needed. You can ignore the Dependent tables data, as that one has not been created yet.
SQL CODE USED TO CREATE THE TABLES:
CREATE TABLE EMPLOYEEmaw
SSNNumber CHAR NOT NULL,
FirstName VARCHAR NOT NULL,
MidName CHAR,
LastName VARCHAR NOT NULL,
Birthday DATE,
Address VARCHAR
Gender CHAR CHECK Gender IN MFmf
Salary DECIMAL DEFAULT
SupervisorSSN CHAR
DepartmentNumber INT,
CONSTRAINT EMPLOYEEPK PRIMARY KEYSSNNumber
CONSTRAINT EMPLOYEEFK FOREIGN KEYSupervisorSSN REFERENCES EMPLOYEEmawSSNNumber;
CREATE TABLE DEPARTMENTmaw
DepartmentName VARCHAR NOT NULL,
DepartmentNumber INT NOT NULL,
ManagerSSN CHAR NOT NULL,
ManageStartDate DATE,
PRIMARY KEY DepartmentNumber
CONSTRAINT DEPARTMENTFK FOREIGN KEY ManagerSSN REFERENCES EMPLOYEEmaw SSNNumber;
CREATE TABLE DEPTLOCATIONmaw
DepartmentNumber INT,
DepartmentLocation VARCHAR
CONSTRAINT PKDEPTLOCATION PRIMARY KEY DepartmentNumber
CONSTRAINT FKDEPTLOCATIONDEPARTMENT FOREIGN KEY DepartmentNumber REFERENCES DEPARTMENTmaw DepartmentNumber ON DELETE CASCADE;
CREATE TABLE PROJECTmaw
ProjectName VARCHAR UNIQUE NOT NULL,
ProjectNumber INT PRIMARY KEY,
ProjectLocation VARCHAR
DepartmentNumber INT,
CONSTRAINT PROJECTmawFK FOREIGN KEY DepartmentNumber REFERENCES DEPARTMENTmawDepartmentNumber;
CREATE TABLE PROJECTASSIGNMENTmaw
EmployeeSSN CHAR
ProjectNumber INT,
Hours DECIMAL NOT NULL,
CONSTRAINT PROJECTASSIGNMENTmawPK PRIMARY KEY EmployeeSSN ProjectNumber
CONSTRAINT PROJECTASSIGNMENTmawEMPFK FOREIGN KEY EmployeeSSN REFERENCES EMPLOYEEmawSSNNumber ON DELETE CASCADE,
CONSTRAINT PROJECTASSIGNMENTmawPROJFK FOREIGN KEY ProjectNumber REFERENCES PROJECTmawProjectNumber ON DELETE CASCADE;
Table Name: EMPLOYEExxx
Table Name: DEPARTMENTxxx
Table Name: DEPTLOCATIONxxx
Table Name: PROJECTxxx
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started