Interview Questions in SQL/PLSQL
Interview Questions in SQL/PLSQL
SET-1
1. What Is SQL?
2. Which command displays the SQL command in the SQL buffer, and then executes it?
3. What is the difference between Truncate & Drop?
4. Explain SQL Having?
5. Difference between SQL Having & Where?
6. Difference between SQL IN/SQL Exists?
7. Difference between SQL NOT IN/SQL NOT Exists?
8. Difference between SQL UNION/SQL UNION ALL?
9. Explain SQL TOP.
10. How to delete duplicate records in a table?
11. How to find duplicate records with the number they are duplicated?
SELECT Id, count (*) as num_records
from table
group by id
having count (*) > 1
12. What is a PRIMARY KEY?
13. What is a FOREIGN KEY?
14. What is a UNIQUE KEY?
15. What is the difference between UNIQUE and PRIMARY KEY?
16. Difference between Unique Key and Primary Key.
17. Difference between Cast & Convert.
18. Explain SQL Group by and give examples.
19. How can you call a PL/SQL procedure from SQL?
20. Which is the subset of SQL commands used to manipulate Oracle Database structures?
21. Write a query to select the Nth highest salary from a table.
22. Write a query to select the 2nd highest salary from a table.
Select * from (select * from employees order by rownum desc) where rownum<2;
1
Select * from (select * from employees order by rownum desc) where rownum<2;