标签:
视图 (view):create view empview as select employee_id id, last_name name, salary sal from employees where department_id = 80
update empview set salary = 10000 where employee_id = 179
(于此同时,employees表中的工号179的人的salary也是10000)
delete from empview where employee_id = 176;
create view empview2 as select employee_id id , last_name name, salary sal ,department_name from employees e, departments d where e.department_id = d.department_id
修改视图create or replace
create or replace view empview2 as select employee_id id , last_name name from employees e, departments d where e.department_id = d.department_id
这样就会将原来的视图覆盖
create or replace view empview2 as select employee_id id , last_name name from employees e, departments d where e.department_id = d.department_id with read only
这个视图只能读,不能改
create or replace view empview3 as select department_name dept_name,avg(salary) avg_sal from employees e , departments d where e.department_id = d.department_id group by department_name
drop view empview3;
select rownum, employee_id , last_name , salary from ( select employee_id , last_name , salary from employees order by salary desc ) where rownum <= 10
查询工资排名40-50名之间
select rn , employee_id , last_name , salary from ( select rownum, employee_id , last_name , salary from ( select employee_id , last_name , salary from employees order by salary desc ) ) where rn > 40 and rn <50
标签:
原文地址:http://blog.csdn.net/wjw0130/article/details/43532245