Test Paper SQL PLSQL 09112021
Test Paper SQL PLSQL 09112021
2021
ZEPTA Consulting & Technologies (Pvt.) Ltd
1. Write a SQL statement to display a string "This is SQL Exercise, Practice and Solution".
4. From the following table, write a SQL query to find the salespeople who lives in the City of '
Lahore'. Return salesperson's name, city.
Table Name: Employee
5. From the above table “nobel_win”, write a SQL query to find the Nobel Prize winners in
'Chemistry' between the years 1965 to 1975. Begin and end values are included. Return
year, subject, winner, and category
6. From the above table “nobel_win”, Write a SQL query to show all details of the Prime
Ministerial winners after 1972 of “Arshad” and “Yaqoob”.
7. From the above table “nobel_win”, write a SQL query to find the details of the winners
whose first name matches with the string 'Sal'. Return year, subject, winner and category.
8. From the above table “nobel_win”, write a SQL query to combine the winners in Physics,
1970 and in Economics, 1971. Return year, subject, winner and category
9. From the above table “nobel_win”, write a SQL query to find the Nobel Prize winners in 1970
excluding the subjects Physiology and Economics. Return year, subject, winner and
category.
10. From the above table “nobel_win”, write a SQL query to find the Nobel Prize winners for the
subject not started with the letter 'P'. Return year, subject, winner and category. Order the
result by year, descending.
11. From the above table “nobel_win”, write a SQL query to select a range of students whose
fees is in the range Rs. 1600 to Rs. 2300. Begin and end values are included. Return year,
subject, winner and category. Order the result by Fees, ascending.
12. From the above table “nobel_win”, write a SQL query to calculate the average fees for the
subject equal to "Physics". Return avg.
13. From the above table “nobel_win”, write a PL/SQL block to calculate the increase 12% fees
of winner whose name is “Salman”
/*******************************************************************/
Table Name: employees
emp_nam
emp_id
e job_name manager_id hire_date salary commission dep_id
68319 FARHAN PRESIDENT 11/18/1991 6000 1001
66928 ADNAN MANAGER 68319 5/1/1991 2750 3001
67832 REHAN MANAGER 68319 6/9/1991 2550 1001
65646 SALMAN MANAGER 68319 4/2/1991 2957 2001
67858 SHAKEEL ANALYST 65646 4/19/1997 3100 2001
69062 RAMEEZ ANALYST 65646 12/3/1991 3100 2001
63679 MOIZ CLERK 69062 12/18/1990 900 2001
64989 MAFAZ SALESMAN 66928 2/20/1991 1700 400 3001
65271 SALAH SALESMAN 66928 2/22/1991 1350 600 3001
66564 SHOAIB SALESMAN 66928 9/28/1991 1350 1500 3001
68454 RAFIQ SALESMAN 66928 9/8/1991 1600 0 3001
68736 ABDULLAH CLERK 67858 5/23/1997 1200 2001
69000 TARIQ CLERK 66928 12/3/1991 1050 3001
69324 AMIR CLERK 67832 1/23/1992 1400 1001
14. From the above table “employees”, write a SQL query to find the managers. Return
complete information about the managers.
15. From the above table “employees”, write a SQL query to find those employees whose salary
is more than the salary of “SALMAN”. Return complete information about the employees.
16. From the above table“employees”, write a SQL query to find those employees who are
senior to “MAFAZ”. Return complete information about the employees.
17. From the above table “employees”, how to find employee salary, if the salary is equal to
“input parameter” with the help of cursor in function, if data not found then return
“Employee Salary not found from Input Parameter”?
18. From the above table “employees”, write a SQL query to find those employees who are
senior employees as of year 1991. Return complete information about the employees.
19. From the above table “employees”, write a SQL query to compute the total salary of the
designation MANAGER. Return total salary.
20. How to find “Consulting” from “ZEPTA Consulting & Technologies (Pvt) Ltd.”
21. Write a trigger on table “Vendors” where you have to check the length of vendor_name
Column. If length of vendor_name is less than 10 characters then display error message