You are on page 1of 4

List of Practical Exercises (ORACLE)

Set 1
Note: Consider the EMP and DEPT tables for the following queries.
1. Retrieve a list of MANAGERS.
2. Find out salary of both MILLER and SMITH.
3. Find out the names and salaries of all employees earning more than 1000 per
month.
4. Display the names and salaries of all employees except JAMES.
5. Find out the details of employees whose names begin with S.
6. Find out the names of all employees that have A anywhere in their name.
7. Find out the names of all employees that have L as their third character in
their name.
8. Find out the names of the employees whose name begin with A or M.
9. Compute yearly salary of SMITH.
10. Compute daily salary of JONES.
11. Calculate the total monthly salary of all employees.
12. Print the average annual salary.
13. Select the name, job, salary, department number of all employees except
SALESMAN from department number 30.
14. List unique departments of the EMP table.
15. List the name and salary of employees who can earn more than 1500 and are in
department 10 or 30.
16. List the name and salary for all employees whose salary is not in the range of 1500
and 2850.
17. Display the name and job of all employees who do not have a MANAGER.
18. Display the name, salary and commission for all employees whose commission

amount is greater than their salary increased by 10%.


19. Display the name of all employees who have two Ls in their name and are in
department 30 or their manager is 7782.
20. Retrieve the names of departments in ascending order and their employees in
descending order.
21. Find out experience of MILLER.
22. How many different departments are there in the employee table.
23. Find out which employee either work in SALES or RESEARCH department.
24. Print the average salary of each department.
25. Select the minimum and maximum salary from employee table.
26. Select the minimum and maximum salaries from each department in employee
table.
27. Select the details of employees whose salary is below 1000 and job is CLERK.
Consider the relations given below:
Set 2
Consider the relations given below:
EMPLOYEE (EmployeeID, EmployeeName, Street, City)
COMPANY (CompanyID, CompanyName, City)
WORKS (EID, CompanyID, Salary)
MANAGES (EmplomployeeyeeID, ManagerID)

I. Create above relations using your own data types and print the structure of the
each relation.
II. Insert at least 10 records in the relation EMPLOYEE and 5 records in the relation
COMPANY. Insert appropriate records in the relations WORKS and MANAGES.
III. Print the contents of the each relation.

IV. Give an expression in SQL with output for each of the following queries:
1. Find the names of all employees who work for First Bank Corporation.
2. Find the names and cities of residence of all employees who work for the First
Bank Corporation.
3. Find the names, street, and cities of residence of all employees who work for
First Bank Corporation and earn more than Rs. 10,000/-.
4. Find the employees who live in the same cities as the companies for which they
work.
5. Find all employees who live in the same cities and on the same streets as do
their managers.
6. Find all employees who do not work for First Bank Corporation.
7. Find all employees who earn more than every employee of Small Bank
Corporation.
8. Find all companies located in every city in which Small Bank Corporation is
located.
9. Find all employees who earn more than the average salary of all employees of their
company.
10. Find the company that has the most employees.
11. Find the company that has the smallest payroll.
12. Find those companies whose employees earn a higher salary, on average, than the
average salary at First Bank Corporation.

PL/SQL PROGRAMS
1. Write a pl/sql program to check the given number is strong or not.
2. Write a pl/sql program to check the given string is palindrome or not.
3. Write a pl/sql program to swap two numbers without using third variable.
4. Write a pl/sql program to generate multiplication tables for 2,4,6.
5. Write a pl/sql program to display sum of even numbers and sum of odd numbers in the given range.

6. Write a pl/sql program to check the given number is pollinndrome or not.


7. The hrd manager has decided to raise the employee salary by 15%. Write a pl/sql block to accept the
employee number and update the salary of that employee. Display appropriate message based on the
existence of the record in emp table.
8. Write a pl/sql program to display top 10 rows in emp table based on their job and salary.

You might also like