Data provided for code evaluation question (This has to be provided with each set for
students to solve code based questions)
Use the following SQL queries to create two tables: employees and department:
-- Create a new database named "my_database"
CREATE DATABASE my_database;
USE my_database;
-- Create the "employees" table
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
department_id INT,
salary INT
);
-- Insert data into the "employees" table
INSERT INTO employees (employee_id, first_name, last_name, department_id, salary) VALUES
(1, 'John', 'Doe', 1, 80000),
(2, 'Jane', 'Doe', 1, 50000),
(3, 'Bob', 'Smith', 2, 60000),
(4, 'Mary', 'Johnson', 3, 55000),
(5, 'Mike', 'Brown', 4, 75000),
(6, 'Samantha', 'Lee', 5, 45000),
(7, 'Tom', 'Wilson', 4, 40000),
(8, 'Emily', 'Garcia', 2, 90000),
(9, 'Jack', 'Taylor', 6, 35000),
(10, 'Olivia', 'Wang', 5, 70000),
(11, 'David', 'Lee', 4, 65000),
(12, 'Amy', 'Chen', 2, 60000),
(13, 'Daniel', 'Park', 1, 85000),
(14, 'Jessica', 'Kim', 3, 55000),
(15, 'Ryan', 'Clark', 5, 50000),
(16, 'Karen', 'Jackson', 4, 40000),
(17, 'Kevin', 'Wu', 2, 60000),
(18, 'Julia', 'Zhang', 6, 35000),
(19, 'Eric', 'Liu', 4, 75000),
(20, 'Michelle', 'Choi', 5, 45000);
-- Create the "departments" table
CREATE TABLE departments (
department_id INT PRIMARY KEY,
department_name VARCHAR(50),
location VARCHAR(50),
employee_count INT
);
-- Insert data into the "departments" table
INSERT INTO departments (department_id, department_name, location, employee_count) VALUES
(1, 'HR', 'New York', 3),
(2, 'IT', 'San Francisco', 4),
(3, 'Accounting', 'Chicago', 2),
(4, 'Sales', 'Los Angeles', 4),
(5, 'Marketing', 'Miami', 4),
(6, 'Customer Service', 'Dallas', 3),
(7, 'Operations', 'Houston', 0),
(8, 'Legal', 'Boston', 0),
(9, 'Finance', 'Seattle', 0),
(10, 'Research and Development', 'San Diego', 0);