InterviewStack.io LogoInterviewStack.io

Relational Databases and SQL Questions

Focuses on relational database fundamentals and practical SQL skills. Candidates should be able to write and reason about SELECT queries, JOINs, aggregations, grouping, filtering, common table expressions, and window functions. They should understand schema design trade offs including normalization and denormalization, indexing strategies and index types, query performance considerations and basic optimization techniques, how to read an execution plan, and transaction semantics including isolation levels and ACID guarantees. Interviewers may test writing efficient queries, designing normalized schemas for given requirements, suggesting appropriate indexes, and explaining how to diagnose and improve slow queries.

EasyTechnical
0 practiced
Describe ACID properties (Atomicity, Consistency, Isolation, Durability) in the context of an ETL job that moves daily sales data into a reporting table. For each property, give a concrete example of what could go wrong in the ETL if the property were not satisfied and how you'd mitigate it.
HardTechnical
0 practiced
Discuss join algorithms (Nested Loop, Hash Join, Merge Join): how they work internally, memory and disk implications, when each is chosen by the planner, and how data ordering and indexes affect the choice. Give examples of query patterns that favor each algorithm.
HardSystem Design
0 practiced
Design an audit/change-log schema to support point-in-time reconstruction of customer records for compliance and debugging. Include table schemas for change_log (id, entity_type, entity_id, changed_at, changed_by, change_type, diff JSONB), indexes to support queries by entity_id and time range, and an example query to reconstruct state at a given timestamp.
MediumTechnical
0 practiced
You need to return all customers who are in the customers table but have no orders in the last 12 months. Given:
customers(customer_id, name)
orders(order_id, customer_id, order_date)
Write two SQL solutions: one using LEFT JOIN/IS NULL (anti-join) and one using NOT EXISTS. Explain performance trade-offs and which you prefer for large datasets.
HardTechnical
0 practiced
Explain how the query planner uses table statistics and histograms to choose plans. Describe what happens when statistics are stale or when data has extreme skew. Provide concrete methods to address wrong plans (e.g., ANALYZE, extended statistics, manual statistics tuning).

Unlock Full Question Bank

Get access to hundreds of Relational Databases and SQL interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.