SQL & Database Interview Handbook
Prepare for SQL and database interviews with 26 chapters: SELECT, joins, CTEs, window functions, 14 classic problems, normalization, schema design, indexing, query optimization, ACID, isolation levels, MVCC, deadlocks, WAL, replication, partitioning, sharding, caching, distributed transactions, security, an interview question bank and a 7-day revision plan.
Price: ₹79 ₹199 · Digital PDF ebook · instant access after purchase
Frequently asked questions
What is the SQL & Database Interview Handbook?
It is a Target Trek ebook of 26 chapters in 6 parts that takes you from SQL basics to database internals and distributed systems. It covers SQL queries, joins, window functions, schema design, indexing, query optimization, transactions, isolation levels, MVCC, locking, replication, sharding, security and a full interview question bank.
Which SQL topics does the book cover?
SELECT and execution order, NULL handling, aggregation, all join types including anti-joins and self joins, subqueries, EXISTS vs IN, CTEs, recursive CTEs, LATERAL, set operations, window functions (ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, running totals), DDL, DML, UPSERT, views, stored procedures and triggers.
Does it include classic SQL interview problems?
Yes. Chapter 6 solves 14 classic problems: second and Nth highest salary, finding and deleting duplicates, top 3 salaries per department, gaps and islands, running totals, month-over-month growth, median salary, pivots with conditional aggregation and customers spending above average.
Does the book explain indexing and query optimization?
Yes. It covers B+ trees, clustered vs non-clustered indexes, composite indexes and the leftmost-prefix rule, covering indexes, partial and expression indexes, why an index is not used, index types beyond B-tree, reading EXPLAIN, scan types, join algorithms, statistics and a tuning checklist.
Are transactions, isolation levels and locking covered?
Yes. Part IV explains ACID, savepoints, the four standard isolation levels, and runs four live demos: non-repeatable read, stable snapshots, lost update and write skew. It also covers MVCC, lock modes, SELECT ... FOR UPDATE, optimistic locking, deadlocks and WAL-based crash recovery.
Does it cover scaling, replication and sharding?
Yes. Part V covers vertical vs horizontal scaling, replication and high availability, failover and split brain, partitioning, choosing a shard key, consistent hashing, resharding, caching, connection pooling, CAP theorem, two-phase commit, sagas, the transactional outbox and idempotency.
Is the book based on PostgreSQL or MySQL?
Examples and experiments use PostgreSQL, and the book includes a PostgreSQL vs MySQL (InnoDB) chapter section with interview talking points. Core SQL and concepts apply to any relational database.
Who is this book for?
Backend developers, full-stack engineers, data and analytics candidates, and anyone preparing for SQL or database rounds at product companies. It works for beginners starting from keys and constraints and for experienced engineers revising internals and scaling.
How long does it take to prepare with this book?
The final chapter includes a 7-day revision plan, an interview-day checklist and cheat sheets for SQL syntax, window functions, isolation levels and indexes, so you can structure your preparation in a week.
How does checkout work and what format is it?
It is a digital ebook with instant access after checkout, and payment opens in a secure checkout window. Digital products are non-refundable after purchase. For help write to [email protected].