1.试创建视图v_emp_80,包含80号部门的员工编号,姓名,年薪列。
CREATE OR REPLACE VIEW v_emp_80
AS
SELECT employee_id,last_name,(salary*12)nian
from employees
where department_id=80;
2.从视图v_emp_80中查询年薪在12万元以上的员工的信息。
select employee_id,last_name,nian
from v_emp_80
where nian>=120000;
3.创建试图v_dml,包含部门编号大于100号的部门的信息。
CREATE OR REPLACE VIEW v_dml
AS
select department_id,department_name,employee_id,location_id
from DEPARTMENTS
where department_id>100;
select * from v_dml t;
4.从视图v_dml插入如下记录:部门编号360,部门名称AAA,管理者编号101,区域编号1700
INSERT INTO v_dml
values(360,'AAA',101,1700);
select * from v_dml t;
5.从视图v_dml中删除300号以上的部门信息。
delete from v_dml
where department_id>300;
select * from v_dml t;
6.给表employees创建同义词em。
CREATE SYNONYM em
for employees;
CREATE OR REPLACE VIEW v_emp_80
AS
SELECT employee_id,last_name,(salary*12)nian
from employees
where department_id=80;
2.从视图v_emp_80中查询年薪在12万元以上的员工的信息。
select employee_id,last_name,nian
from v_emp_80
where nian>=120000;
3.创建试图v_dml,包含部门编号大于100号的部门的信息。
CREATE OR REPLACE VIEW v_dml
AS
select department_id,department_name,employee_id,location_id
from DEPARTMENTS
where department_id>100;
select * from v_dml t;
4.从视图v_dml插入如下记录:部门编号360,部门名称AAA,管理者编号101,区域编号1700
INSERT INTO v_dml
values(360,'AAA',101,1700);
select * from v_dml t;
5.从视图v_dml中删除300号以上的部门信息。
delete from v_dml
where department_id>300;
select * from v_dml t;
6.给表employees创建同义词em。
CREATE SYNONYM em
for employees;