Escolar Documentos
Profissional Documentos
Cultura Documentos
1. Create a view called EMP_VU based on the employee number, employee name, and
department number from the EMP table. Change de heading for the employee name
to EMPLOYEE.
create view emp_vu
as select empno, ename EMPLOYEE, deptno
from emp;
3. Select the view name and text from the data dictionary USER_VIEWS.
select VIEW_NAME
from USER_VIEWS;
4. Using your view EMP_VU, enter a query to display all employee names and
department numbers.
create or replace view emp_vu
as select ename EMPLOYEE, deptno DEPTNO
from emp;
5. Create a view named DEPT20 that contains the employee number, employee name,
and department number for all employees in department 20. Label the view column
EMPLOYEE_ID, EMPLOYEE, and DEPARTMENT_ID. Do not allow an employee
to be reassigned to another department through the view(LLEVA CONSTRAINT).
create or replace view dept20
as select empno EMPLOYEE_ID, ename EMPLOYEE, deptno DEPARTMENT_ID
from emp
where deptno=20
with check option;
8. Create a view called SALARY_VU based on the employee name, department name,
salary, and salary grade for all employees. Label the columns Employee, Department,
Salary, and Grade, respectively.
create or replace view salary_vu
as select e.ename, d.dname, e.sal, s.grade
from emp e, dept d, salgrade s
where e.deptno=d.deptno and e.sal
between s.losal and s.hisal;