CREATE TABLE departments (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
);
INSERT INTO departments VALUES
(1, 'Engineering'), (2, 'Sales'), (3, 'Marketing'), (4, 'Legal');
CREATE TABLE employees (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT NOT NULL,
salary INTEGER NOT NULL,
department_id INTEGER REFERENCES departments(id),
manager_id INTEGER REFERENCES employees(id)
);
INSERT INTO employees VALUES
(1, 'Ava', '[email protected]', 180000, 1, NULL),
(2, 'Ben', '[email protected]', 180000, 1, 1),
(3, 'Chloe', '[email protected]', 150000, 1, 1),
(4, 'Dan', '[email protected]', 120000, 1, 2),
(5, 'Eve', '[email protected]', 190000, 1, 2),
(6, 'Finn', '[email protected]', 95000, 2, NULL),
(7, 'Gia', '[email protected]', 110000, 2, 6),
(8, 'Hal', '[email protected]', 70000, 2, 6),
(9, 'Ivy', '[email protected]', 70000, 2, 6),
(10, 'Jo', '[email protected]', 85000, 3, NULL),
(11, 'Kai', '[email protected]', 85000, 3, 10),
(12, 'Lea', '[email protected]', 60000, 3, 10);