Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table jobs(job_id INT primary key,
- job_name varchar(20) not null unique,
- min_salary numeric(8,2)not null check(min_salary>1500),
- max_salary numeric(8,2)not null check(min_salary>1500))
- create table employees(emp_id INT primary key,
- first_name varchar(30) not null ,
- last_name varchar(30) not null ,
- salary numeric(8,2)not null check(salary>1500),
- manager_id int references employees(emp_id),
- job_id int not null references jobs(job_id) deferrable initially deferred);
- begin;
- insert into employees values(1,'a','b',2000,null,1);
- insert into jobs values (1, 'CEO',10000,15000);
- commit;
- begin;
- delete from employees where job_id=3;
- rollback;
- commit;
- begin;
- insert into employees values(4,'g','h',2000,1,3);
- insert into jobs values (3, 'HR',2000,5000);
- commit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement