You are on page 1of 3

Oracle Lab Exercise for Day 3

1.

Which employees earn less than 30% of the president's salary

2.

List the name, job and salary of people in department 20 who have the same job
as people in the RESEARCH department.

3.

List the employee name that does not end in S.

4.

Display the department no which has more than one clerk.

5.

Find the employee who earns more than the average salary in their own
department.

6.

Find all the employees working in department 10 other than KING.

7.

How many employees work in New York?

8.

Add a new employee with No: 8888, Name: HARRIS, Job: ANALYST,
Mgr:7566, Hiredate:08-APR-1985, Sal:2500, Deptno:20.

9.

Change the Millers job description from CLERK to MANAGER.

10.

Give all the employees in department 30 a salary hike of 10% who do not get any
commission.

11.

Give 5% rise in salary who are getting commission between 0 and 300

12.

Delete all employees in department 20.

13.

Create a table EMPCOPY which contains the following columns:


EMPNO -- Primary key should generate numbers automatically
EMPNAME Should not be null
JOB Should always be one of them PROGRAMMER / TRAINEE /ADMIN
SALARY Should be always >7000
HIREDATE Default should be current date
DEPTNO Should refer to the DEPTNO in iGateDEPT

14.

Create a table EMPDEPT with the following columns


DEPTNO Primary Key
DEPTNAME -- It should not be null

15.

Insert the values.

16.

Create a view consisting of names, numbers, jobs, salaries and departments of


employees in department 10.

17.

From the above view list the average annual salary for all the people in
department 10 who make less than 5000.

18.

Create a view FINANCE with data from the EMP which gives their total salary
and average salary.

19.

Create a view LOCATION from both EMP & DEPT to make it possible to see
where some one works.

20.

From the above view list the employees located in CHICAGO in order by
employee name.

21.

Create an index on salary of employee table.

22.

Create an index on department number and job of employee table.

VIEWS
1.

Create a view called EMP_VU based on the employee number, employee name
and department number of all employees from EMP table. Change the heading for
employee name to EMPLOYEE.

2.

Display the structure of the view EMP_VU.

3.

Display the contents of the EMP_VU.

4.

Select view name and text from USER_VIEWS.

5.

Create a view name 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 this view.

6.

Display the structure of the DEPT20 view.

7.

Assign to reassign SMITH to department 30. What happened?

8.

Create a view called SALARY_VU based on the employee name, department


name, salary and salary grade for all employees. Label the columns Employees,
Department, Salary and Grade respectively.

9.

Create an index on salary column of EMPLOYEE table.

10.

Confirm the same from data dictionary that the index is created.

11.

Create a table called TEST with one column as Primary key.

12.

Confirm that an index is created implicitly.

13.

Drop the table TEST and check that the corresponding index is also dropped.

You might also like