0% found this document useful (0 votes)
20 views2 pages

pr01 - SQL - DML - Exercises - 2025

Uploaded by

Eyyoub Soullami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

pr01 - SQL - DML - Exercises - 2025

Uploaded by

Eyyoub Soullami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Consider the following schema:

DEPT (DEPTNO, DNAME, LOC)

EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)

SIMPLE QUERIES, SET OPERATORS, FUNCTIONS, GROUP BY, HAVING:

1. Who has any commission? (NOT NULL)

2. Which employees work on a department not located at Boston or Chicago? (MINUS)

3. Who earns more than 3000 or works on dept. 30? (UNION)

4. Who was hired before 01-06-1981? (DATE TYPE, FUNCTIONS)

5. How much is the maximal salary of the employees?

6. How much is the sum of the salary of the employees?

7. How much is the average salary of the employees of department 20?

8. How many different jobs are there amongst the employees?

9. How many employees has greater salary than 2000?

10. List the average of the salary grouped by the departments!

11. List the number of workers for each departments!

12. List the average salary of those departments which has average salary greater than 2000!

13. List the average salary of those departments which has more than 4 workers!

SUBQUERIES AND JOINS:

14. Who has the same salary and works on the same department than MARTIN (CROSS JOIN)

15. Which employees work on a department located at Boston or Chicago? (JOIN, NATURAL JOIN)

16. Who earns more than ALLEN?

17. Select the employees with their job who have the lowest/highest salary!

18. List the lowest salary for every department where the lowest salary is below the lowest salary of dept. 30

19. Who earns less than any/every CLERK?

20. Which dept. has no employee? (OUTER JOIN or SUBQUERY with NOT EXIST )

21. Determine the number of employees for every deptartment! (0 where the dept has no employee)
DELETE:

22. Delete the employees with NULL commission!

23. Delete the employees who hired before 1982!

24. Delete the employees who works in Dallas!

25. Delete the employees who has lower salary than tha average!

26. Delete the employee with the highest salary!

27. Delete the departments which have at least 2 employee in the second salary grade (SALGRADE table)

INSERT:

28. Insert a new employee called ’Williams’ to the EMP table. Empno=1, ename=' Williams ', deptno=10,
hire_date=today, sal=average salary of dept. 10. Rest of the attributes be NULL.

UPDATE:

29. Increase the salary of employees at dept. 20 by 20%.

30. Increase everyone’s commission with the highest commision.

You might also like