SQL Revision 1

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

REVISION- SQL PRACTICE

Based on the given tables, answer the question that follows.

Sample Table – Worker

WORKER_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT


001 Monika Arora 100000 2014-02-20 09:00:00 HR
002 Niharika Verma 80000 2014-06-11 09:00:00 Admin
003 Vishal Singhal 300000 2014-02-20 09:00:00 HR
004 Amitabh Singh 500000 2014-02-20 09:00:00 Admin
005 Vivek Bhati 500000 2014-06-11 09:00:00 Admin
006 Vipul Diwan 200000 2014-06-11 09:00:00 Account
007 Satish Kumar 75000 2014-01-20 09:00:00 Account
008 Geetika Chauhan 90000 2014-04-11 09:00:00 Admin

Sample Table – Bonus

WORKER_REF_ID BONUS_DATE BONUS_AMOUNT


1 2016-02-20 00:00:00 5000
2 2016-06-11 00:00:00 3000
3 2016-02-20 00:00:00 4000
1 2016-02-20 00:00:00 4500
2 2016-06-11 00:00:00 3500

Sample Table – Title

WORKER_REF_ID WORKER_TITLE AFFECTED_FROM

1 Manager 2016-02-20 00:00:00


2 Executive 2016-06-11 00:00:00
8 Executive 2016-06-11 00:00:00
5 Manager 2016-06-11 00:00:00
4 Asst. Manager 2016-06-11 00:00:00
7 Executive 2016-06-11 00:00:00
6 Lead 2016-06-11 00:00:00
3 Lead 2016-06-11 00:00:00

1) Write an SQL query to fetch “FIRST_NAME” from the Worker table using the alias name
<WORKER_NAME>
2) Write an SQL query to fetch “FIRST_NAME” from the Worker table in upper case.
3) Write an SQL query to fetch unique values of DEPARTMENT from the Worker table
4) Write an SQL query to print the first three characters of FIRST_NAME from the Worker table
5) Write an SQL query to print all Worker details from the Worker table order by FIRST_NAME
Ascending.
6) Write an SQL query to print all Worker details from the Worker table order by FIRST_NAME
Ascending and DEPARTMENT Descending
7) Write an SQL query to print details for Workers with the first names “Vipul” and “Satish”
from the Worker table.
8) Write an SQL query to print details of workers excluding first names, “Vipul” and “Satish”
from the Worker table.
9) Write an SQL query to print details of Workers with DEPARTMENT name as “Admin”.
10) Write an SQL query to print details of the Workers whose FIRST_NAME contains ‘a’.
11) Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’.
12) Write an SQL query to print details of the Workers whose SALARY lies between 100000 and
500000.
13) Write an SQL query to print details of the Workers who joined in Feb’2014.
14) Write an SQL query to fetch the count of employees working in the department ‘Admin’.
15) Write an SQL query to fetch worker names with salaries >= 50000 and <= 100000.
16) Write an SQL query to fetch the no. of workers for each department in descending order
17) Write an SQL query to print details of the Workers who are also Managers

You might also like