Practice Ques: Select As From
Practice Ques: Select As From
1.Write an SQL query to fetch “FIRST_NAME” from Worker table using the alias name as <WORKER_NAME>.
2.Write an SQL query to fetch “FIRST_NAME” from Worker table in upper case.
3. Write an SQL query to fetch unique values of DEPARTMENT from Worker table.
4. Write an SQL query to print the first three characters of FIRST_NAME from Worker
table.
5. Write an SQL query to find the position of the alphabet (‘a’) in the first name
column ‘Amitabh’ from Worker table.
6.Write an SQL query to print the FIRST_NAME from Worker table after removing white
spaces from the right side.
7. Write an SQL query that fetches the unique values of DEPARTMENT from Worker table
and prints its length.
8. Write an SQL query to print the FIRST_NAME from Worker table after replacing ‘a’
with ‘A’.
9. Write an SQL query to print the FIRST_NAME and LAST_NAME from Worker table into a
single column COMPLETE_NAME. A space char should separate them.
10. Write an SQL query to print all Worker details from the Worker table order by
FIRST_NAME Ascending.
11. Write an SQL query to print details for Workers with the first name as “Vipul” and
“Satish” from Worker table
12. Write an SQL query to print details of workers excluding first names, “Vipul” and
“Satish” from Worker table.
13. Write an SQL query to print details of Workers with DEPARTMENT name as “Admin”.
14. Write an SQL query to print details of the Workers whose FIRST_NAME contains ‘a’.
select * from worker where FIRST_NAME like '%a%';
15. Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘a’.
16. Write an SQL query to print details of the Workers whose FIRST_NAME ends with ‘h’
and contains six alphabets.
17. Write an SQL query to print details of the Workers whose SALARY lies between
100000 and 500000.
18. Write an SQL query to print details of the Workers who have joined in Feb’2014.
19. Write an SQL query to fetch the count of employees working in the department
‘Admin’
20. Write an SQL query to fetch worker names with salaries >= 50000 and <= 100000.
21. Write an SQL query to fetch the no. of workers for each department in the
descending order.
22.Write an SQL query to fetch the no. of workers for each department in the
descending order.
23. Write an SQL query to print details of the Workers who are also Managers.
24. Write an SQL query to fetch duplicate records having matching data in some fields
of a table.
25. Write an SQL query to show only odd rows from a table.
26. Write an SQL query to show only even rows from a table.
29. Write an SQL query to show the top n (say 10) records of a table.
30.