SQL Database Technical Questions Interview Questions
10 curated questions with evaluation guidance for hiring managers.
Explain the different types of JOINs in SQL with examples. When would you use each?
Should explain INNER, LEFT/RIGHT OUTER, FULL OUTER, CROSS, and SELF joins with clear use cases. Look for understanding of which join produces which result set and performance implications.
How do you optimize a slow-running SQL query? Walk me through your process.
Should discuss examining execution plan (EXPLAIN), identifying bottlenecks (full table scans, missing indexes, expensive sorts), adding/modifying indexes, rewriting queries. Look for systematic approach.
What are database indexes and how do they work? Explain different types of indexes.
Should explain B-tree, hash, composite, covering, partial, and full-text indexes. Should understand trade-offs: faster reads vs. slower writes and more storage. Look for practical index design.
Explain ACID properties. Why are they important in database systems?
Should explain Atomicity (all or nothing), Consistency (valid state), Isolation (concurrent transactions), Durability (committed data persists). Look for real examples of violations.
What is database normalization? Explain 1NF, 2NF, and 3NF. When might denormalization be appropriate?
Should explain each normal form clearly and when to stop (usually 3NF). Should discuss denormalization for read performance in analytics/reporting. Look for pragmatic balance.
How do you handle database migrations in a production environment with live traffic?
Should discuss backward-compatible migrations, expand-contract pattern, zero-downtime schema changes, and rollback strategies. Look for production migration experience.
Explain the difference between clustered and non-clustered indexes.
Should explain clustered index determines physical data order (one per table), non-clustered creates separate structure with pointers. Look for understanding of covering indexes and key lookups.
What is database sharding? When would you implement it and what challenges does it introduce?
Should explain horizontal partitioning across multiple databases, shard keys, and trade-offs (joins across shards, resharding, data distribution). Look for practical understanding of complexity.
Write a query to find duplicate records in a table and delete one copy of each duplicate.
Should use window functions (ROW_NUMBER with PARTITION BY) or GROUP BY with HAVING, and DELETE with CTE or subquery. Look for clean, efficient SQL.
How do transactions and isolation levels work? What problems can dirty reads, non-repeatable reads, and phantom reads cause?
Should explain Read Uncommitted, Read Committed, Repeatable Read, Serializable and their trade-offs between consistency and performance. Look for practical examples.
Want AI-generated interview questions tailored to your specific job description? Workro analyses your JD and generates behavioural and technical questions calibrated for the role, seniority level, and required skills — in seconds.
Try free