Free Download · No Sign-Up Required

SQL & Databases
Question Set

80+ carefully curated SQL & Database interview questions covering queries, joins, indexing, normalization, transactions, stored procedures, NoSQL, and database design — ideal for freshers and experienced professionals alike.

Browse Questions ↓
85+ Total Questions
9 Topics Covered
3 Levels Difficulty
100% No Cost Ever

9 Key SQL & Database Areas

Questions span 9 core domains — from basic SELECT queries and joins all the way to transaction management, query optimization, and modern NoSQL databases.

All 85+ Questions

Browse all questions below — or download the beautifully formatted PDF for offline study and interview prep.

🔍
10 Qs
01What is SQL? Differentiate between DDL, DML, DCL, and TCL with examples.Basic
02Write a SQL query to retrieve all columns from a table called employees where salary is greater than 50,000.Basic
03What is the difference between WHERE and HAVING clauses? When is each used?Basic
04Explain GROUP BY with an example. How does it work with aggregate functions?Basic
05What is the difference between DELETE, TRUNCATE, and DROP?Basic
06What are aggregate functions? Name five and explain their usage.Basic
07How does the ORDER BY clause work? Can you order by multiple columns?Basic
08What is a subquery? Write an example of a correlated vs non-correlated subquery.Medium
09Explain DISTINCT, LIMIT, and OFFSET in SQL with use-cases.Basic
10What is the difference between UNION and UNION ALL? When would you choose one over the other?Medium
🔗
10 Qs
11What are the different types of SQL JOINs? Explain each with a diagram description.Basic
12What is an INNER JOIN? Write a query joining orders and customers on customer_id.Basic
13Explain LEFT JOIN vs RIGHT JOIN. What happens when there is no matching row on the outer side?Basic
14What is a FULL OUTER JOIN and when would you use it? Is it supported in MySQL?Medium
15What is a CROSS JOIN? Give a practical use-case where it makes sense.Medium
16What is a SELF JOIN? Write an example query to find employees who have the same manager.Medium
17What is the difference between a Primary Key and a Foreign Key? Can a table have multiple foreign keys?Basic
18What is referential integrity? How do ON DELETE CASCADE and ON UPDATE CASCADE work?Medium
19How do you retrieve the second-highest salary from an employees table? Write multiple approaches.Medium
20Write a query to find all customers who have NOT placed any orders (using both LEFT JOIN and NOT EXISTS).Medium
📐
10 Qs
21What is database normalization? Why is it important in relational database design?Basic
22Explain First Normal Form (1NF). What problem does it solve? Give a before/after example.Basic
23What is Second Normal Form (2NF)? Explain partial dependency with an example.Medium
24What is Third Normal Form (3NF)? How does transitive dependency violate 3NF?Medium
25What is Boyce-Codd Normal Form (BCNF)? How does it differ from 3NF?Advanced
26What is denormalization? When would you intentionally denormalize a database?Medium
27What is an Entity-Relationship (ER) diagram? Explain entities, attributes, and relationships.Basic
28What are the different types of relationships in database design? (1:1, 1:N, M:N) Give real-world examples.Basic
29What is a composite key? When should you use it instead of a surrogate key?Medium
30What is a candidate key vs a super key? Explain with a table example.Medium
8 Qs
31What is a database index? How does it improve query performance?Basic
32What is the difference between a Clustered and a Non-Clustered index?Medium
33What is a composite index? When should you use one and how does column order matter?Medium
34What are the downsides of indexing? Why shouldn't you index every column?Medium
35What is a covering index? How can it eliminate table lookups?Advanced
36What is EXPLAIN / EXPLAIN ANALYZE? How do you use it to diagnose slow queries?Medium
37What is query optimization? List five best practices for writing performant SQL.Medium
38What is database partitioning? Explain horizontal vs vertical partitioning and sharding.Advanced
🔄
8 Qs
39What is a database transaction? Explain COMMIT, ROLLBACK, and SAVEPOINT.Basic
40What are ACID properties? Explain each: Atomicity, Consistency, Isolation, Durability.Basic
41What are transaction isolation levels in SQL? Explain READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, and SERIALIZABLE.Medium
42What is a Dirty Read, Non-Repeatable Read, and Phantom Read? Which isolation levels prevent each?Medium
43What is a deadlock in a database? How can it be detected and prevented?Advanced
44What is optimistic vs pessimistic locking? When would you use each?Advanced
45What is a two-phase commit (2PC)? How does it ensure consistency in distributed transactions?Advanced
46What is Write-Ahead Logging (WAL)? How does it contribute to database durability?Advanced
📦
10 Qs
47What is a View in SQL? How do you create one and what are its advantages?Basic
48What is the difference between a simple view and a complex view? Can you update data through a view?Medium
49What is a Stored Procedure? How does it differ from a function in SQL?Basic
50Write a stored procedure that accepts an employee ID and returns their department name and salary.Medium
51What are the advantages of stored procedures? (Security, performance, reusability)Medium
52What is a Trigger in SQL? Explain BEFORE and AFTER triggers with an example.Medium
53What is a user-defined function (UDF)? What is the difference between scalar and table-valued functions?Medium
54What is a Cursor in SQL? When should you use one and what are the performance concerns?Advanced
55What are Materialized Views? How do they differ from regular views and when are they useful?Advanced
56What is a sequence / auto-increment? How is it used to generate primary keys?Basic
🏗️
10 Qs
57What are Window Functions? Explain ROW_NUMBER(), RANK(), and DENSE_RANK() with examples.Advanced
58What is PARTITION BY in window functions? How does it differ from GROUP BY?Advanced
59What is a CTE (Common Table Expression)? Write an example using WITH. How does it differ from a subquery?Medium
60What is a Recursive CTE? Write a query to traverse a hierarchical employee-manager table.Advanced
61What is CASE WHEN in SQL? Write a query that categorises employees by salary bracket.Medium
62What is PIVOT and UNPIVOT in SQL? Give a real-world use-case.Advanced
63What are LEAD() and LAG() window functions? Write a query showing month-over-month sales change.Advanced
64What is the difference between EXISTS and IN? Which is more performant and why?Medium
65How do you handle NULL values in SQL? Explain IS NULL, COALESCE(), and NULLIF().Medium
66What is a temporal table (system-versioned table)? How is it used for historical data tracking?Advanced
🍃
10 Qs
67What is NoSQL? How does it differ from relational databases? When would you choose NoSQL?Basic
68What are the four main types of NoSQL databases? (Document, Key-Value, Column-Family, Graph) — give an example of each.Basic
69What is MongoDB? Explain collections, documents, and BSON. How do you perform a basic CRUD operation?Basic
70What is the CAP theorem? Explain Consistency, Availability, and Partition Tolerance with examples.Medium
71What is eventual consistency in NoSQL systems? How does it trade off with strong consistency?Medium
72What is Redis? What data structures does it support and what are its common use-cases?Medium
73What is Cassandra? Explain its wide-column model, partition key, and clustering columns.Advanced
74What is a graph database? How does Neo4j represent data and when would you use it over a relational DB?Medium
75What is Elasticsearch? How does it index documents and what are its primary use-cases?Medium
76How do you choose between SQL and NoSQL for a new project? What factors drive that decision?Medium
☁️
9 Qs
77What are managed cloud database services? Compare AWS RDS, Azure SQL Database, and Google Cloud SQL.Medium
78What is Amazon DynamoDB? Explain its key-value and document model, and its pricing model.Medium
79What is a Data Warehouse? How does it differ from an OLTP database? Give examples (Snowflake, Redshift).Medium
80What is OLTP vs OLAP? How do their schema designs (star schema, snowflake schema) differ?Medium
81What is a Data Lake? How does it differ from a Data Warehouse and when would you use each?Medium
82What is database replication? Explain master-slave (primary-replica) replication and its benefits.Advanced
83What is database caching? Explain how caching layers (Redis, Memcached) reduce DB load.Medium
84What is a NewSQL database? Name examples and explain how they combine SQL features with NoSQL scalability.Advanced
85What is database migration? What tools and strategies are used for zero-downtime schema changes in production?Advanced
📥

Want all 85+ questions as a formatted PDF?

Perfect for printing, offline study, and interview prep — download completely free.

Explore Other Sets

Free question banks across all major tech domains — curated by industry experts, available to download instantly.

🤖
AI / ML Question Set
80 Questions · Fundamentals to Advanced
ML Algorithms Deep Learning NLP MLOps
View Questions →
🐍
Python Question Set
75 Questions · Beginner to Advanced
Basics OOP Data Structures Libraries
🌐
Web Development Question Set
90 Questions · HTML, CSS, JS, React
HTML5 CSS3 JavaScript React
☁️
Cloud & DevOps Question Set
65 Questions · AWS, Docker, CI/CD
AWS Docker Kubernetes CI/CD
📊
Data Science Question Set
80 Questions · Statistics, Pandas, Viz
Statistics Pandas NumPy EDA
🔒
Cybersecurity Question Set
60 Questions · Network, Threats, Tools
Networking Cryptography OWASP Firewalls
🗄️

Get the SQL & Databases PDF — Free

All 85+ questions in a beautifully formatted PDF. Delivered to your inbox instantly — no cost, no spam.

🔒 Your data is 100% safe. Unsubscribe anytime.

Join WhatsApp Channel