SQL Interview Guide
Comprehensive collection of most important SQL questions with examples.
Basic SQL Interview Questions
• What is SQL?
• What are the different types of SQL statements (DDL, DML, DCL, TCL, DQL)?
• Difference between DELETE, TRUNCATE, and DROP.
• What is a Primary Key and Foreign Key?
• What are Constraints in SQL?
Intermediate SQL Questions
• Explain JOIN and its types with examples.
• Difference between WHERE and HAVING.
• What are Aggregate Functions (COUNT, SUM, AVG, etc.)?
• Explain Subquery with an example.
• What is Normalization? List normal forms.
• What is a View and Index?
Advanced SQL Questions
• Find the second-highest salary from Employee table.
• Find duplicate records in a table.
• Find employees who earn more than their department average.
• Difference between UNION and UNION ALL.
• What is a Self Join?
• Explain Common Table Expression (CTE).
• Difference between OLTP and OLAP databases.
Scenario-Based SQL Questions
• Find department with highest number of employees.
• List employees who joined in the last 30 days.
• Find top 3 highest salaries.
• Display employee names with their department names.
• Find total sales by each salesperson.