Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Exercise Series 4: Functions, GROUP BY and

HAVING clause

1. How many employees work in Antwerp?

2. How many employees with job Programmer are there at the Technica office?

3. What is the average salary of the employees with job Analyst? Round off
mathematically to 0 decimal places.

4. What is the total salary of employees in the Training sector?

5. For each job, give the lowest salary and the highest salary paid to an employee.

6. Which employees (give the empno) can be replaced by 2 or more employees?

7. Give the number of employees per job.

8. Provide the number of employees per sector with a salary between 50000 and 100000.
9. Give per city the number of employees that are overpaid (earning more than the
corresponding maximum salary).

10. Give the average salary per sector. Round off mathematically to 0 decimal places. Sort
by average.
11. Give the number of articles of which the quality is 1. Give also the total weight of these
articles.

12. Give the number of different values that appear in the quality column of the table
articles.

13. Give the number of projects to which driver D1 has delivered articles.

14. Give the number of deliveries per driver.

15. Give the total quantity of articles delivered per project.

16. With the exception of deliveries by driver D1, for each article delivered, give the article
number and the total quantity delivered for that article.

17. Which articles (ano) are delivered to multiple projects?


18. Specify the drivers (dno) whose deliveries have an average quantity of more than 300
units.

19. Give the drivers (dno and dname) with at least 2 deliveries of article A1.

20. Give the number and the name of the driver and the article number for which the driver
delivered the article at least 3 times.
21. Give the average price per book category. Round off the average price to 2 decimals.
Sort by rising average price.

22. Give the number of authors per hometown. Sort alphabetically by hometown.

23. Give per publisher (pno, publisher) the number of books in the category Roman that he
has published.

24. Give the books that were published no more than 10 years ago. Sort by title.

25. Provide an alphabetical list of authors who this year have an age divisible by 5 (e.g. 45,
50, ...).

You might also like