create table dept(  
  deptno     number(2,0),  
  dname      varchar2(40),  
  loc        varchar2(13),  
  constraint pk_dept primary key (deptno)  
);

create table emp(  
  empno    number(4,0),  
  ename    varchar2(40),  
  job      varchar2(9),  
  mgr      number(4,0),  
  hiredate date,  
  sal      number(7,2),  
  comm     number(7,2),  
  deptno   number(2,0),  
  constraint pk_emp primary key (empno),  
  constraint fk_deptno foreign key (deptno) references dept (deptno)  
);

insert into DEPT (DEPTNO, DNAME, LOC)
values(10, 'Oracle.HR.ACCOUNTING', 'NEW YORK');
insert into dept  
values(20, 'Oracle.HR.RESEARCH', 'DALLAS');
insert into dept  
values(30, 'Oracle.HR.SALES', 'CHICAGO');
insert into DEPT (DEPTNO, DNAME, LOC)
values(40, 'IBM.HR.ACCOUNTING', 'NEW YORK');
insert into dept  
values(50, 'IBM.HR.RESEARCH', 'DALLAS');
insert into dept  
values(60, 'IBM.HR.SALES', 'CHICAGO');

insert into emp  
values(  
 7839, 'KING', 'PRESIDENT', null,  
 to_date('17-11-1981','dd-mm-yyyy'),  
 5000, null, 10  
);

insert into emp  
values(  
 7698, 'BLAKE', 'MANAGER', 7839,  
 to_date('1-5-1981','dd-mm-yyyy'),  
 2850, null, 30  
);

insert into emp  
values(  
 7782, 'CLARK', 'MANAGER', 7839,  
 to_date('9-6-1981','dd-mm-yyyy'),  
 2450, null, 10  
);

insert into emp  
values(  
 7566, 'JONES', 'MANAGER', 7839,  
 to_date('2-4-1981','dd-mm-yyyy'),  
 2975, null, 20  
);

insert into emp  
values(  
 7788, 'SCOTT', 'ANALYST', 7566,  
 to_date('13-JUL-87','dd-mm-rr') - 85,  
 3000, null, 20  
);

select * from emp;
select * from dept;
commit;
