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

1.4 Assignment-Assignment 4 Create Table

The document outlines the creation of two SQL tables: Employees and Departments. It includes the structure of both tables, defining their columns and data types, and provides sample data insertion for each table. The Employees table contains employee details while the Departments table lists department names.

Uploaded by

koulibalyhamam
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)
39 views1 page

1.4 Assignment-Assignment 4 Create Table

The document outlines the creation of two SQL tables: Employees and Departments. It includes the structure of both tables, defining their columns and data types, and provides sample data insertion for each table. The Employees table contains employee details while the Departments table lists department names.

Uploaded by

koulibalyhamam
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

-- Creating the Employees table

CREATE TABLE Employees (


EmployeeID INT PRIMARY KEY,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
Email NVARCHAR(100) UNIQUE,
DepartmentID INT,
HireDate DATE,
Salary DECIMAL(10, 2)
);

-- Creating the Departments table


CREATE TABLE Departments (
DepartmentID INT PRIMARY KEY,
DepartmentName NVARCHAR(100)
);

-- Inserting data into the Employees table


INSERT INTO Employees (EmployeeID, FirstName, LastName, Email, DepartmentID,
HireDate, Salary)
VALUES
(1, 'John', 'Smith', '[email protected]', 101, '2021-06-15', 75000.00),
(2, 'Jane', 'Doe', '[email protected]', 102, '2020-03-10', 85000.00),
(3, 'Michael', 'Johnson', '[email protected]', 101, '2019-11-22',
95000.00),
(4, 'Emily', 'Davis', '[email protected]', 103, '2022-01-05', 68000.00),
(5, 'William', 'Brown', '[email protected]', 102, '2018-07-19', 80000.00);

-- Inserting data into the Departments table


INSERT INTO Departments (DepartmentID, DepartmentName)
VALUES
(101, 'Human Resources'),
(102, 'Finance'),
(103, 'IT');

You might also like