Answered step by step
Verified Expert Solution
Link Copied!

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 EMPLOYEE_maw
(SSN_Number CHAR(9) NOT NULL,
First_Name VARCHAR(15) NOT NULL,
Mid_Name CHAR,
Last_Name VARCHAR(15) NOT NULL,
Birthday DATE,
Address VARCHAR(50),
Gender CHAR CHECK (Gender IN ('M','F','m','f')),
Salary DECIMAL DEFAULT 80000,
Supervisor_SSN CHAR(9),
Department_Number INT,
CONSTRAINT EMPLOYEE_PK PRIMARY KEY(SSN_Number),
CONSTRAINT EMPLOYEE_FK FOREIGN KEY(Supervisor_SSN) REFERENCES EMPLOYEE_maw(SSN_Number));
CREATE TABLE DEPARTMENT_maw
(Department_Name VARCHAR(15) NOT NULL,
Department_Number INT NOT NULL,
Manager_SSN CHAR(9) NOT NULL,
ManageStartDate DATE,
PRIMARY KEY (Department_Number),
CONSTRAINT DEPARTMENT_FK FOREIGN KEY (Manager_SSN) REFERENCES EMPLOYEE_maw (SSN_Number));
CREATE TABLE DEPT_LOCATION_maw
(Department_Number INT,
Department_Location VARCHAR(15),
CONSTRAINT PK_DEPT_LOCATION PRIMARY KEY (Department_Number),
CONSTRAINT FK_DEPT_LOCATION_DEPARTMENT FOREIGN KEY (Department_Number) REFERENCES DEPARTMENT_maw (Department_Number) ON DELETE CASCADE);
CREATE TABLE PROJECT_maw
(Project_Name VARCHAR(15) UNIQUE NOT NULL,
Project_Number INT PRIMARY KEY,
Project_Location VARCHAR(15),
Department_Number INT,
CONSTRAINT PROJECT_maw_FK FOREIGN KEY (Department_Number) REFERENCES DEPARTMENT_maw(Department_Number));
CREATE TABLE PROJECT_ASSIGNMENT_maw
(Employee_SSN CHAR(9),
Project_Number INT,
Hours DECIMAL(3,1) NOT NULL,
CONSTRAINT PROJECT_ASSIGNMENT_maw_PK PRIMARY KEY (Employee_SSN, Project_Number),
CONSTRAINT PROJECT_ASSIGNMENT_maw_EMP_FK FOREIGN KEY (Employee_SSN) REFERENCES EMPLOYEE_maw(SSN_Number) ON DELETE CASCADE,
CONSTRAINT PROJECT_ASSIGNMENT_maw_PROJ_FK FOREIGN KEY (Project_Number) REFERENCES PROJECT_maw(Project_Number) ON DELETE CASCADE);
Table Name: EMPLOYEE_xxx
Table Name: DEPARTMENT_xxx
Table Name: DEPT_LOCATION_xxx
Table Name: PROJECT_xxx
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel 2024 In 7 Days

Authors: Alan Dinkins

1st Edition

B0CJ3X98XK, 979-8861224000

More Books

Students also viewed these Databases questions

Question

What has been the relation between imperialism and foreign trade?

Answered: 1 week ago

Question

Apply entertainment-education for social initiatives.

Answered: 1 week ago