Oracle SQL Exercises
Oracle SQL Exercises
Table of Contents
Simple Queries ........................................................................................................................................ 2
Exercises .............................................................................................................................................. 2
1
Simple Queries
Exercises
Exercise 1.1
List the name, hire date, job of the employees of the department 20, sorted in descending by the
names.
Exercise 1.2
Make two lists, which contain all the information about the employees. The first should be sorted
ascending, the second in descending by the salaries.
Exercise 1.3
List the names, salaries, and income of the employees, sorted in descending by the income. The
income is the sum of the salary and the commission.
Exercise 1.4
List the name, department number, income, and tax of the employees, sorted in descending by the
tax. The tax is the 20% of the income.
Exercise 1.5
List the name, job, and salary of those employees, whose salary in not in the 1500-2850 interval. The
headers of the list should be “Name”, “Job”, and “Salary”.
Exercise 1.6
List the name, job, salary, commission, department number of those employees, whose salary is
greater than 1000, and were hired between 1981.03.01. and 1981.09.30.
Exercise 1.7
List the name, commission, manager number of those employees, who has a commission. Sort the
list by the manager number first, then by the employee name.
Exercise 1.8
List the number, name, job, salary, and commission of those employees, whose commission is
greater than the 50% of their salary.
Exercise 1.9
List the name, job, salary, and hire date of those employees, who was hired in 1981. Sort the list by
the hire date.
Exercise 1.10
List the name, job, income of those employees, whose name contains two letter “L”s, or works for
department 30, or his manager’s number is 7782.
Exercise 1.11
List the name, and yearly salary of the clerks, and the salesmen, sorted by department number.
2
Exercise 1.12
List the number, name, job, hire date, and commission of the employees. For those employees, who
does not have any commission, the ‘No commission’ string should appear.
Exercise 1.13
List the names, and jobs of those employees, whose name contains the ‘man’ string. Sort the list by
the job first, then by the name.
Exercise 1.14
List the names, jobs, income, and department number of those employees, whose income is lesser
than 2500, and was hired between 1981, and 1982. Sort the list by the job first, then by the name.
Exercise 1.15
List the name, yearly salary, and the number of months in work of those employees, who was hired
before 1981.07.01. Sort the list by the month numbers.
Exercise 1.16
List the name (beginning with uppercase letter, followed by lowercase letters), and the length of the
name of those employees, whose job’s name begins with ‘C’ or ‘M’. Sort the list by the job.
Exercise 1.17
List the number, name, income, the day, when he was hired, and the department number of those
employees, whose income is between 1300 and 5500. Sort the list by the number of the days in the
week first, then the name of the employee.
Exercise 1.18
List the number, name, salary, and the number of years in work of those employees, who was hired
at least 15 years ago.
Exercise 1.19
List the names, jobs, salaries, and salary categories of the employees. The salary category is 1 below
1000, 2 below 2000, and 3 for higher. Sort the result descending by the category.
Exercise 1.20
List the name, number, and title of the employees. The title is ‘BOSS’ for those, who has at least one
subordinate, and NULL if has not.