Sie sind auf Seite 1von 2

create table job ( jobid number(2) not null primary key, desig varchar(20) not null); create table

dept1 ( deptno number(2) not null primary key, deptnm varchar(15) not null); create table emp1 ( eid number(4) not null primary key, enm varchar(30) not null, sal number(7,2) not null, jobid number(2) not null references job(jobid), deptno number(2) not null references dept1(deptno)); create table job_his ( eid number(4) not null references emp1(eid), jobid number(2) not null references job(jobid)); /******************************************************/ /*****************************************************/ insert insert insert insert insert insert insert insert insert insert insert insert insert insert insert insert insert insert into into into into into into into into into into into into into into into into into into job job job job values(1, values(2, values(3, values(4, 'Sales Manager'); 'Clerk'); 'Accountant'); 'Consultant'); 'Research'); 'Consultancy'); 'Marketing'); 'Accounts'); 'Sonal',98789.99, 4, 20); 'Prabhu Dayal Maheshwari', 98768.98, 1, 10); 'Priyanka', 98687.97, 1, 30); 'Surabhi',26067.76, 2, 40); 'Ankan',53245.2, 3, 40); 'Garima Patni',23456.86, 4, 10); 'Gaurav',56786.86, 4, 30); 'Anju Sharma',34568.54, 2, 10); 'Aastha', 66554.29, 3, 20); 'Suhani Agiwal', 7653.54, 3, 10);

dept1 dept1 dept1 dept1 emp1 emp1 emp1 emp1 emp1 emp1 emp1 emp1 emp1 emp1

values(10, values(20, values(30, values(40, values(1001, values(1002, values(1003, values(1004, values(1005, values(1006, values(1007, values(1008, values(1009, values(1010,

/******************************************************/ /*****************************************************/ 1. select e.enm, e.jobid,d.deptno,d.deptnm from emp1 e, dept1 d where e.deptno=d.deptno order by e.enm, e.jobid; 2. select e.enm,j.desig,d.deptno,d.deptnm from emp1 e, dept1 d, job j where e.deptno=d.deptno and e.jobid=j.jobid and j.desig='Sales Manager';

3. select enm,deptno from emp1 where deptno in (select deptno from emp1 where enm='Sonal') order by deptno; 4. create or replace trigger "INSERT_JOB_HIS" after update of jobid on emp1 referencing new as nrow old as orow for each row when (nrow.jobid<>orow.jobid) begin insert into job_his values(:orow.eid,:orow.jobid); end; / 5. update emp1 set sal=sal*.10+sal where eid in(select distinct(eid) from job_his); 6. create table ndept1 as (select dno from dept1);

Das könnte Ihnen auch gefallen