DROP TABLE DEPT_EMP;
DROP TABLE EMPLOYEE;
DROP TABLE DEPARTMENT;
CREATE TABLE EMPLOYEE (ID INTEGER GENERATED ALWAYS AS IDENTITY NOT NULL, F_NAME VARCHAR(255), L_NAME VARCHAR(255), SALARY BIGINT, PRIMARY KEY (ID));
CREATE TABLE DEPARTMENT (ID INTEGER GENERATED ALWAYS AS IDENTITY NOT NULL, NAME VARCHAR(255), PRIMARY KEY (ID));
CREATE TABLE DEPT_EMP (DEPT_ID INTEGER NOT NULL, EMP_ID INTEGER NOT NULL, EMP_FNAME VARCHAR(255), EMP_LNAME VARCHAR(255), PRIMARY KEY (DEPT_ID, EMP_ID));
ALTER TABLE DEPT_EMP ADD CONSTRAINT DEPTREF FOREIGN KEY (DEPT_ID) REFERENCES DEPARTMENT (ID);
ALTER TABLE DEPT_EMP ADD CONSTRAINT EMPREF FOREIGN KEY (EMP_ID) REFERENCES EMPLOYEE (ID);
