-- 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');