w3resource

PL/SQL while loop exercises

PL/SQL While Loop [ 21 exercises with solution ]

1. Write a PL/SQL program to display the names of all countries.

Click me to see the solution

2. Write a PL/SQL program to display the job titles of all employees. Return a heading of job title.

Click me to see the solution

3. Write a PL/SQL program to display the location IDs and cities of all locations along with the proper heading.

Click me to see the solution

4. Write a PL/SQL program to display the employee IDs, names, job titles, hire dates, and salaries of all employees.

Click me to see the solution

5. Write a PL/SQL program to display the employee IDs, names, and department names of all employees.

Click me to see the solution

6. Write a PL/SQL program to display the employee IDs, names, and manager names of all employees.

Click me to see the solution

7. Write a PL/SQL program to display the job IDs, titles, and minimum salaries of all jobs.

Click me to see the solution

8. Write a PL/SQL program to display the employee IDs, names, and job titles of all employees.

Click me to see the solution

9. Write a PL/SQL program to display the employee IDs, names, and job history start dates of all employees.

Click me to see the solution

10. Write a PL/SQL program to display the employee IDs, names, and job history end dates of all employees.

Click me to see the solution

11. Write a PL/SQL program to display the department IDs, names, and the name of the city where the department is located of all departments.

Click me to see the solution

12. Write a PL/SQL program to display all the departments along with the names of employees working in each department.

Click me to see the solution

13. Write a PL/SQL program to display the average salary for each job. Return job title and average salary in a row.

Click me to see the solution

14. Write a PL/SQL program to display the total salary expense for each department. Return depart name and salary expenses in tabular form.

Click me to see the solution

15. Write a PL/SQL program to display the number of employees in each department using a nested while loop. Return department name and number of employees.

Click me to see the solution

16. Write a PL/SQL program to display the total number of employees hired each year between 1985 and 2000. Return the result in tabular format.

Click me to see the solution

17. Write a PL/SQL program to display the number of employees in each country. Return country name and number of employees.

Click me to see the solution

18. Write a PL/SQL program to display the average salary for each department.

Click me to see the solution

19. Write a PL/SQL program to display the employees who have the highest salary in each department using a nested while loop.

Click me to see the solution

20. Write a PL/SQL program to display the employees who have the lowest salary in each department.

Click me to see the solution

21. Write a PL/SQL program to display the department name with the maximum number of employees.

Click me to see the solution



Follow us on Facebook and Twitter for latest update.