DROP TABLE IF EXISTS departments;
CREATE TABLE departments ( 
dept_no CHAR(4), 
dept_name VARCHAR(40) 
);

DROP TABLE IF EXISTS dept_manager;
CREATE TABLE dept_manager (
emp_no INT,
dept_no CHAR(4),
from_date DATE,
to_date DATE
); 

INSERT INTO departments VALUES ('d001','Marketing'), ('d002','Finance'), ('d003','Human Resources'), ('d004','Production'), ('d005','Development'), ('d006','Quality Management'), ('d007','Sales'), ('d008','Research'), ('d009','Customer Service'); 

INSERT INTO dept_manager VALUES (110022,'d001','1985-01-01','1991-10-01'), (110039,'d001','1991-10-01','9999-01-01'), (110085,'d002','1985-01-01','1989-12-17'), (110114,'d002','1989-12-17','9999-01-01'), (110183,'d003','1985-01-01','1992-03-21'), (110228,'d003','1992-03-21','9999-01-01'), (110303,'d004','1985-01-01','1988-09-09'), (110344,'d004','1988-09-09','1992-08-02'), (110386,'d004','1992-08-02','1996-08-30'), (110420,'d004','1996-08-30','9999-01-01'), (110511,'d005','1985-01-01','1992-04-25'), (110567,'d005','1992-04-25','9999-01-01'), (110725,'d006','1985-01-01','1989-05-06'), (110765,'d006','1989-05-06','1991-09-12'), (110800,'d006','1991-09-12','1994-06-28'), (110854,'d006','1994-06-28','9999-01-01'), (111035,'d007','1985-01-01','1991-03-07'), (111133,'d007','1991-03-07','9999-01-01'), (111400,'d008','1985-01-01','1991-04-08'), (111534,'d008','1991-04-08','9999-01-01'), (111692,'d009','1985-01-01','1988-10-17'), (111784,'d009','1988-10-17','1992-09-08'), (111877,'d009','1992-09-08','1996-01-03'), (111939,'d009','1996-01-03','9999-01-01'), (NULL, NULL, NULL, NULL); 