Skip to content

Instantly share code, notes, and snippets.

@machinelearningplus
Created September 3, 2023 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machinelearningplus/09d40dcbf49c513e4114c91af772e748 to your computer and use it in GitHub Desktop.
Save machinelearningplus/09d40dcbf49c513e4114c91af772e748 to your computer and use it in GitHub Desktop.
--Employees, Departments, Sales Tables
DROP TABLE IF EXISTS EMPLOYEES;
CREATE TABLE Employees (
ID INT PRIMARY KEY,
Name VARCHAR(100),
Salary DECIMAL(10,2),
DepartmentID INT
);
INSERT INTO Employees (ID, Name, Salary, DepartmentID)
VALUES (1, 'Alice', 35000, 1),
(2, 'Bob', 40000, 2),
(3, 'Carol', 55000, 3),
(4, 'David', 60000, 2),
(5, 'Ethan', 70000, 1);
---------------------------
DROP TABLE IF EXISTS DEPARTMENTS;
CREATE TABLE Departments (
ID INT PRIMARY KEY,
Name VARCHAR(100)
);
INSERT INTO Departments (ID, Name)
VALUES (1, 'HR'),
(2, 'Finance'),
(3, 'Marketing');
----------------------------
DROP TABLE IF EXISTS SALES;
CREATE TABLE Sales (
EmployeeID INT,
Product VARCHAR(100),
Quantity INT
);
INSERT INTO Sales (EmployeeID, Product, Quantity)
VALUES (1, 'A', 10),
(1, 'B', 5),
(2, 'A', 7),
(2, 'C', 3),
(3, 'B', 8),
(3, 'C', 2),
(4, 'A', 9),
(4, 'B', 6),
(5, 'C', 4),
(5, 'A', 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment