Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views1 page

Cse2101 Graded Lab

The document outlines the SQL schema for a database with four tables: Department, Employee, Project, and Assignment. Each table includes primary keys and relevant fields, with foreign key relationships established between Employee and Department, Project and Department, and Assignment with both Employee and Project. This structure facilitates the management of departments, employees, projects, and their assignments.

Uploaded by

kalief sobers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Cse2101 Graded Lab

The document outlines the SQL schema for a database with four tables: Department, Employee, Project, and Assignment. Each table includes primary keys and relevant fields, with foreign key relationships established between Employee and Department, Project and Department, and Assignment with both Employee and Project. This structure facilitates the management of departments, employees, projects, and their assignments.

Uploaded by

kalief sobers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

CREATE TABLE Department (

DepartmentID INTEGER PRIMARY KEY AUTOINCREMENT,


DepartmentName VARCHAR(100) NOT NULL
);

CREATE TABLE Employee (


EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
FirstName VARCHAR(100) NOT NULL,
LastName VARCHAR(100) NOT NULL,
HireDate DATE NOT NULL,
DepartmentID INTEGER,
FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID)
);

CREATE TABLE Project (


ProjectID INTEGER PRIMARY KEY AUTOINCREMENT,
ProjectName VARCHAR(100) NOT NULL,
DepartmentID INTEGER,
FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID)
);

CREATE TABLE Assignment (


AssignmentID INTEGER PRIMARY KEY AUTOINCREMENT,
EmployeeID INTEGER,
ProjectID INTEGER,
AssignmentDate DATE NOT NULL,
HoursWorked DECIMAL(5,2) NOT NULL,
FOREIGN KEY (EmployeeID) REFERENCES Employee(EmployeeID),
FOREIGN KEY (ProjectID) REFERENCES Project(ProjectID)
);

You might also like