-- Step 1: Create the database
CREATE DATABASE CompanyDB;
-- Step 2: Use the database
USE CompanyDB;
-- Step 3: Create the Employees table
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY AUTO_INCREMENT,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Department VARCHAR(50),
Salary DECIMAL(10, 2)
);
-- Step 4: Insert sample data into the Employees table
INSERT INTO Employees (FirstName, LastName, Department, Salary)
VALUES
('Alice', 'Smith', 'HR', 60000.00),
('Bob', 'Johnson', 'IT', 75000.00),
('Carol', 'Williams', 'HR', 65000.00),
('David', 'Brown', 'Finance', 80000.00),
('Eve', 'Jones', 'IT', 70000.00);
-- Step 5: Execute the given query
SELECT FirstName, LastName
FROM Employees
WHERE Department = 'HR';
-- Exercise for learners:
-- Uncomment the following query and modify it to retrieve employees
-- from the 'IT' department instead of 'HR'.
-- SELECT FirstName, LastName
-- FROM Employees
-- WHERE Department = 'IT';