Database Exercise 7 Data Manipulation

  • 9 Create a view for use by personnel in department 30 showing employee name, number, job and hiredate
create view runbin_7_9 as select ename, empno, job, hiredate from emp2016150071 where deptno = 30;
commit;
select * from runbin_7_9;
  • 10 Use the view to show employees in department 30 having jobs which are not salesman
select * from runbin_7_9 where job != 'SALESMAN';
  • 11 Create a view which shows summary information for each department.
create view runbin7_11 as
select deptno, count(distinct job) as TypesOfJob,count(deptno) as populations, avg(sal) as avgOfSal from emp2016150071 group by deptno;
select * from runbin7_11;
select * from emp2016150071;

你可能感兴趣的:(Database Exercise 7 Data Manipulation)