Skip to content

Instantly share code, notes, and snippets.

@machinelearningplus
Created September 19, 2023 03:52
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/db0208295c30cf7d0b826b17a1c20109 to your computer and use it in GitHub Desktop.
Save machinelearningplus/db0208295c30cf7d0b826b17a1c20109 to your computer and use it in GitHub Desktop.
-- Create the employees table
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
department_id INT
);
-- Insert sample data into the employees table
INSERT INTO employees (employee_id, first_name, last_name, department_id)
VALUES
(1, 'John', 'Doe', 1),
(2, 'Jane', 'Smith', 2),
(3, 'Bob', 'Johnson', 1),
(4, 'Alice', 'Williams', NULL);
-- Create the departments table
CREATE TABLE departments (
department_id INT PRIMARY KEY,
department_name VARCHAR(50)
);
-- Insert sample data into the departments table
INSERT INTO departments (department_id, department_name)
VALUES
(1, 'HR'),
(2, 'IT'),
(3, 'Finance');
-- Create the projects table
CREATE TABLE projects (
project_id INT PRIMARY KEY,
project_name VARCHAR(100),
department_id INT
);
-- Insert sample data into the projects table
INSERT INTO projects (project_id, project_name, department_id)
VALUES
(101, 'Employee Training', 1),
(102, 'Database Upgrade', 2),
(103, 'Budget Analysis', 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment