Advanced SQL Interview Preparation (Freshers to 9
LPA Level)
Core SQL Topics To Know
DDL: CREATE, ALTER, DROP, TRUNCATE
DML: INSERT, UPDATE, DELETE
DQL: SELECT
TCL: COMMIT, ROLLBACK, SAVEPOINT
DCL: GRANT, REVOKE
Important Clauses
WHERE – filter rows
GROUP BY – group rows
HAVING – filter grouped data
ORDER BY – sorting results
LIMIT – restrict output rows
Joins
INNER JOIN – matching rows from both tables
LEFT JOIN – all rows from left table
RIGHT JOIN – all rows from right table
FULL JOIN – all rows from both tables
Aggregate Functions
COUNT(), SUM(), AVG(), MIN(), MAX()
Advanced Topics
Subqueries
Correlated Subqueries
Window Functions
Indexes
Views
Stored Procedures
Transactions
Top 50 SQL Interview Questions with Answers
Question Answer
1. What is SQL? Language used to interact with relational databases.
2. What is DBMS? Software used to manage databases.
3. What is RDBMS? Database with relationships between tables.
4. What is a primary key? Unique identifier for each row.
5. What is a foreign key? Key used to link two tables.
6. What is normalization? Process of removing redundancy in database design.
7. What is denormalization? Adding redundancy to improve performance.
8. Difference between WHERE and HAVING? WHERE filters rows, HAVING filters groups.
9. What is a join? Combining rows from multiple tables.
10. Types of joins? INNER, LEFT, RIGHT, FULL.
11. What is a subquery? Query inside another query.
12. What is a correlated subquery? Subquery that depends on outer query.
13. What is GROUP BY? Groups rows with same values.
14. What is ORDER BY? Sorts query results.
15. What is DISTINCT? Removes duplicate values.
16. What is an index? Improves query speed.
17. What is a view? Virtual table created from query.
18. What is a stored procedure? Precompiled SQL code.
19. What is a trigger? Code automatically executed on table events.
20. What is ACID? Atomicity, Consistency, Isolation, Durability.
21. What is a transaction? Group of SQL operations executed together.
22. Difference between DELETE and TRUNCATE? DELETE removes rows, TRUNCATE clears table quickly.
23. Difference between DROP and TRUNCATE? DROP deletes table, TRUNCATE removes rows only.
24. What is a constraint? Rule applied to column values.
25. Types of constraints? PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK.
26. What is UNION? Combines results removing duplicates.
27. What is UNION ALL? Combines results including duplicates.
28. What is LIMIT? Restricts number of rows returned.
29. What is OFFSET? Skips rows before returning results.
30. What is a self join? Table joined with itself.
31. What is a cross join? Cartesian product of two tables.
32. What is a natural join? Automatically joins using same column names.
33. What is a composite key? Primary key using multiple columns.
34. What is a candidate key? Possible column that can be primary key.
35. What is a super key? Set of columns uniquely identifying rows.
36. What is database schema? Structure of database tables.
37. What is data integrity? Accuracy and consistency of data.
38. What is referential integrity? Foreign key maintains valid references.
39. What is a window function? Performs calculations across rows.
40. Example window function? ROW_NUMBER(), RANK(), DENSE_RANK().
41. What is ROW_NUMBER()? Assigns unique number to rows.
42. What is RANK()? Assigns ranking with gaps.
43. What is DENSE_RANK()? Ranking without gaps.
44. What is PARTITION BY? Divides rows into groups for window functions.
45. What is indexing drawback? Extra storage and slower writes.
46. What is clustered index? Sorts table data physically.
47. What is non-clustered index? Separate structure referencing table rows.
48. What is query optimization? Improving query performance.
49. What is execution plan? Database strategy to execute query.
50. What is transaction log? Record of database changes.