Skip to content

Instantly share code, notes, and snippets.

@machinelearningplus
Created September 19, 2023 01:18
Show Gist options
  • Save machinelearningplus/5de032e6ef9bd96c0833f6192c6b78c1 to your computer and use it in GitHub Desktop.
Save machinelearningplus/5de032e6ef9bd96c0833f6192c6b78c1 to your computer and use it in GitHub Desktop.
CREATE TABLE employees (
employee_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
department VARCHAR(50),
salary DECIMAL(10, 2)
);
INSERT INTO employees (first_name, last_name, department, salary)
VALUES
('John', 'Doe', 'HR', 50000.00),
('Jane', 'Smith', 'Engineering', 60000.00),
('Alice', 'Johnson', 'Finance', 55000.00),
('Bob', 'Brown', 'Sales', 52000.00),
('Eva', 'Williams', 'Marketing', 48000.00),
('Chris', 'Davis', 'Engineering', 62000.00),
('Sarah', 'Wilson', 'Finance', 56000.00),
('Mike', 'Jones', 'HR', 51000.00),
('Linda', 'Martinez', 'Sales', 53000.00),
('Tom', 'Moore', 'Marketing', 49000.00);
-- Adding more rows for a larger table
-- You can generate more data using a tool or script for a truly large table
INSERT INTO employees (first_name, last_name, department, salary)
SELECT
SUBSTRING(MD5(RAND()), 1, 5),
SUBSTRING(MD5(RAND()), 1, 5),
CASE
WHEN RAND() < 0.2 THEN 'HR'
WHEN RAND() < 0.4 THEN 'Engineering'
WHEN RAND() < 0.6 THEN 'Finance'
WHEN RAND() < 0.8 THEN 'Sales'
ELSE 'Marketing'
END,
FLOOR(50000 + (RAND() * 10000))
FROM employees;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment