CREATE SCHEMA PUBLIC AUTHORIZATION DBA CREATE USER SA PASSWORD "" GRANT DBA TO SA SET WRITE_DELAY 20 SET SCHEMA PUBLIC create table department (id integer generated by default as identity, name varchar(255) not null,version integer not null) create table address (id integer generated by default as identity, name varchar(255) not null, version integer not null) create table employee (id integer generated by default as identity,name varchar(255) not null,job_type integer not null,salary integer,department_id integer,address_id integer,version integer not null,constraint EMPLOYEE_FK1 FOREIGN KEY(DEPARTMENT_ID) REFERENCES DEPARTMENT(ID),constraint EMPLOYEE_FK2 FOREIGN KEY(ADDRESS_ID) REFERENCES ADDRESS(ID)) alter table employee add constraint uq_address unique(address_id) INSERT INTO DEPARTMENT VALUES(1,'ACCOUNTING',1) INSERT INTO DEPARTMENT VALUES(2,'RESEARCH',1) INSERT INTO DEPARTMENT VALUES(3,'SALES',1) INSERT INTO DEPARTMENT VALUES(4,'OPERATIONS',1) INSERT INTO ADDRESS VALUES(1,'STREET 1',1) INSERT INTO ADDRESS VALUES(2,'STREET 2',1) INSERT INTO ADDRESS VALUES(3,'STREET 3',1) INSERT INTO ADDRESS VALUES(4,'STREET 4',1) INSERT INTO ADDRESS VALUES(5,'STREET 5',1) INSERT INTO ADDRESS VALUES(6,'STREET 6',1) INSERT INTO ADDRESS VALUES(7,'STREET 7',1) INSERT INTO ADDRESS VALUES(8,'STREET 8',1) INSERT INTO ADDRESS VALUES(9,'STREET 9',1) INSERT INTO ADDRESS VALUES(10,'STREET 10',1) INSERT INTO ADDRESS VALUES(11,'STREET 11',1) INSERT INTO ADDRESS VALUES(12,'STREET 12',1) INSERT INTO ADDRESS VALUES(13,'STREET 13',1) INSERT INTO ADDRESS VALUES(14,'STREET 14',1) INSERT INTO EMPLOYEE VALUES(1,'ALLEN',1,1600,3,1,1) INSERT INTO EMPLOYEE VALUES(2,'WARD',1,1250,3,2,1) INSERT INTO EMPLOYEE VALUES(3,'JONES',2,2975,2,3,1) INSERT INTO EMPLOYEE VALUES(4,'MARTIN',1,1250,3,4,1) INSERT INTO EMPLOYEE VALUES(5,'BLAKE',2,2850,3,5,1) INSERT INTO EMPLOYEE VALUES(6,'CLARK',2,2450,1,6,1) INSERT INTO EMPLOYEE VALUES(7,'SCOTT',3,3000,2,7,1) INSERT INTO EMPLOYEE VALUES(8,'KING',4,5000,1,8,1) INSERT INTO EMPLOYEE VALUES(9,'TURNER',1,1500,3,9,1) INSERT INTO EMPLOYEE VALUES(10,'ADAMS',0,1100,2,10,1) INSERT INTO EMPLOYEE VALUES(11,'JAMES',0,950,3,11,1) INSERT INTO EMPLOYEE VALUES(12,'FORD',3,3000,2,12,1) INSERT INTO EMPLOYEE VALUES(13,'MILLER',0,1300,1,13,1) INSERT INTO EMPLOYEE VALUES(14,'SMITH',0,800,2,14,1)