Sample Table – Worker
WORKER_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT
001 Monika Arora 100000 2021-02-20 HR
002 Niharika Verma 80000 2021-06-11 Admin
003 Vishal Singhal 300000 2021-02-20 HR
004 Amitabh Singh 500000 2021-02-20 Admin
005 Vivek Bhati 500000 2021-06-11 Admin
006 Vipul Diwan 200000 2021-06-11 Account
007 Satish Kumar 75000 2021-01-20 Account
008 Geetika Chauhan 90000 2021-04-11 Admin
Sample Table – Bonus
WORKER_REF_ID BONUS_DATE BONUS_AMOUNT
1 2023-02-20 5000
2 2023-06-11 3000
3 2023-02-20 4000
1 2023-02-20 4500
2 2023-06-11 3500
Sample Table – Title
WORKER_REF_ID WORKER_TITLE AFFECTED_FROM
1 Manager 2023-02-20
2 Executive 2023-06-11
8 Executive 2023-06-11
5 Manager 2023-06-11
WORKER_REF_ID WORKER_TITLE AFFECTED_FROM
4 Asst. Manager 2023-06-11
7 Executive 2023-06-11
6 Lead 2023-06-11
3 Lead 2023-06-11
1. Write an SQL query to fetch the number of workers for each department in descending
order.
2. Write an SQL query to fetch duplicate records having matching data in some fields of a
table.
3. Write an SQL query to show the second-highest salary from a table.
3. Write an SQL query to determine the 5th highest salary
4. Write an SQL query to fetch the list of employees with the same salary.
5. Write an SQL query to fetch the departments that have less than five people in them.
6. Write an SQL query to show all departments along with the number of people in there.
7. Write an SQL query to fetch three max salaries from a table.
8. Write an SQL query to fetch three min salaries from a table.
9. Write an SQL query to fetch departments along with the total salaries paid for each of
them.
10. Write an SQL query to fetch the names of workers who earn the highest salary.