Top 50 SQL Interview questions and concept for freshers and experienced

Hello friends, In this post, I have listed out the interview questions that needs to be prepared if you planning to attained the technical interview on database and sql.

  1. What is anomalies in DBMS? Types of anomalies?
  2. What is normalization? Advantage and Disadvantage of normalization?
  3. What is normal forms in relational database? how many types of normal form are available?
  4. What is keys ? What are the different types of keys available in DBMS – Super Key, Primary Key, Candidate Key, Foreign Key, Non Key.
  5. What is constraints in SQL Server? Types of constraints ? Give example of constraints?
  6. Difference between Primary Key vs Candidate Key?
  7. Difference between Primary Key vs Unique Key?
  8. Difference between Primary Key vs Foreign Key?
  9. Difference between Group By vs Order By?
  10. Order of execution of Group By, Order By, Where, Having? 
  11. Difference between Char and Varchar in sql server?
  12. Difference between Varchar and NVarchar?
  13. Difference between Delete, Drop and Truncate table? Which is faster and why?
  14. What is Stored procedure? Advantage of using Stored procedures?
  15. Compare Query vs Stored procedure? Which is good for performance? 
  16. What is User Defined Function? Advantage of using UDF?
  17. Types of UDF? What is Scaler and Table valued function?
  18. Types of Table valued functions – Inline and multi-statement function?
  19. Difference between Stored procedure vs UDF? Scenario of using SP and UDF?
  20. What is View ? Advantage of using View ? When we should use View?
  21. What is Updatable view? What are the rules for updatable view?
  22. What is Index view/Materialized view? How to write a indexed view in sql server? 
  23. Difference between View and Stored Procedure? Scenario of using View and Stored Procedures?
  24. What is JOINs? Types of JOINs in sql server?
  25. Difference between Inner/Outer/Full Join?
  26. What is Self Join? Example?
  27. What is Equi join and Natural Join?
  28. How to optimize JOINs if we have multiple table ?
  29. Union and UnionAll? Differences?
  30. What is Temp table? Types of Temp table? Where does Temp table stores data?
  31. Difference between Local Temp table vs Global temp tables?
  32. How does Temp table behaves within the stored procedure? 
  33. What is Common Table expression- CTE? What is the use of CTE ? Types of CTE ? Syntax of using CTE?
  34. Can we use CTE as target in DML operations?
  35. Should we use CTE immediately after definition? Restriction of using CTE?
  36. What is trigger? Advantage of using trigger?
  37. If we have SP then why do we need triggers? What is the real use of triggers? Example
  38. Difference between Trigger and stored procedure?
  39. Can we execute trigger through code or script?
  40. How can you handle exceptions in sql server?
  41. What is cursor in sql server? 
  42. Advantage and Disadvantage of using cursor?
  43. What is Index? Types of index? Syntax?
  44. Difference between Cluster and Non-Clustered index? 
  45. What are the points needs to be considered when applying indexes on table?
  46. What are the Locking mechanism used in sql server? What is pessimistic and optimistic locks? How to implement?
  47. What is transactions? Why do we need transaction? How to implement transaction?
  48. What is Partitioning ? Types of Partitioning ? Differences?
  49. What is Sharding in sql server? 
  50. What are the various way to improve the performance of sql query and stored procedure?

     Frequently asked Queries :

  •  1. How to get Nth highest salary from employee table?
  •  2. Department wise highest salary when 2 tables has given – Employee and Department.
  • 3.  List out EmployeeName with ManagerName from the given Employee Table.
  • 4. Query which needs LIKE keyword.

 

admin

Software professional, Blogger, Tech enthusiast.