A production-grade, interview-focused course covering SQL, NoSQL, system design, and real-world database engineering. Built to make you both interview-ready and portfolio-strong.
- Why This Course
- Repository Structure
- Learning Paths
- SQL Mastery
- Database Design
- NoSQL & Distributed Systems
- Performance Optimization
- Transactions & Concurrency
- Problem Bank
- Projects
- Cheatsheets
- Setup Guide
- How to Use This Repo
- Contributing
Most interview prep resources teach you what SQL is. This course teaches you how interviewers think:
- Pattern recognition β every hard SQL problem reduces to 3β5 repeatable patterns
- Trade-off fluency β explain why you chose a schema, index, or system design decision
- Production habits β write queries and schemas the way senior engineers do
- Portfolio output β every module produces code you can push to GitHub and show recruiters
Target roles: Data Engineer, Backend Engineer, Analytics Engineer, Data Analyst, ML Engineer, Database Administrator
database-interview-prep/
β
βββ sql/ # SQL mastery modules
β βββ 01_basics/
β βββ 02_joins/
β βββ 03_aggregations/
β βββ 04_window_functions/
β βββ 05_ctes_and_subqueries/
β βββ 06_query_optimization/
β βββ 07_advanced_patterns/
β
βββ nosql/ # NoSQL systems
β βββ 01_mongodb/
β βββ 02_redis/
β βββ 03_sql_vs_nosql/
β βββ 04_vector_databases/ β embeddings, HNSW, pgvector, Qdrant, RAG
β
βββ system-design/ # Schema design & architecture
β βββ 01_er_diagrams_and_schema/
β βββ 02_normalization/
β βββ 03_cap_theorem/
β βββ 04_scaling_strategies/
β
βββ notes/ # Deep-dive reference notes
β βββ transactions_and_concurrency.md
β βββ indexing_strategies.md
β βββ performance_optimization.md
β
βββ cheatsheets/ # Quick-revision reference cards
β βββ sql_cheatsheet.md
β βββ nosql_cheatsheet.md
β βββ top_50_sql_interview_questions.md
β
βββ problems/ # Categorized problem bank
β βββ easy/
β βββ medium/
β βββ hard/
β
βββ projects/ # Portfolio-grade projects
β βββ 01_library_db/
β βββ 02_ecommerce_db/
β βββ 03_analytics_dashboard/
β βββ 04_social_media_db/
β βββ 05_capstone_system/
β
βββ datasets/ # Seed data for all projects
β
βββ SETUP.md # Local + cloud DB setup guide
βββ CONTRIBUTING.md # How to contribute
βββ README.md # This file
| Role | Duration | Focus |
|---|---|---|
| Data Analyst | 2 weeks | SQL Modules 1β5 β Problems (easy+medium) β Projects 1β2 |
| Backend Engineer | 3 weeks | SQL Modules 1β7 β System Design β NoSQL β Projects 1β3 |
| Data Engineer | 4 weeks | All SQL β NoSQL β Performance β System Design β All Projects |
| Quick Revision | 3 days | Cheatsheets β Top 50 Questions β Hard Problems |
| Module | Topics | Interview Weight |
|---|---|---|
| 01 β Basics | SELECT, WHERE, ORDER BY, GROUP BY, HAVING | ββ |
| 02 β Joins | INNER, LEFT, RIGHT, FULL, SELF, CROSS joins | βββββ |
| 03 β Aggregations | COUNT, SUM, AVG, GROUP BY, HAVING, ROLLUP | ββββ |
| 04 β Window Functions | ROW_NUMBER, RANK, LAG/LEAD, PARTITION BY | βββββ |
| 05 β CTEs & Subqueries | WITH, recursive CTEs, correlated subqueries | ββββ |
| 06 β Query Optimization | EXPLAIN, indexes, execution plans | ββββ |
| 07 β Advanced Patterns | Gaps & islands, pivoting, top-N per group | βββββ |
| Module | Topics |
|---|---|
| ER Diagrams & Schema | Entities, relationships, cardinality, schema SQL |
| Normalization | 1NF β 3NF β BCNF, denormalization trade-offs |
| CAP Theorem | Consistency, availability, partition tolerance |
| Scaling Strategies | Replication, sharding, partitioning, read replicas |
| Module | Topics | Interview Weight |
|---|---|---|
| MongoDB | Document model, aggregation pipeline, indexing | βββ |
| Redis | Data structures, caching patterns, pub/sub | ββββ |
| SQL vs NoSQL | When to use what, trade-off frameworks | ββββ |
| Vector Databases | Embeddings, HNSW/IVF, pgvector, Qdrant, Pinecone, RAG schema | βββββ |
β See notes/indexing_strategies.md and notes/performance_optimization.md
- B-Tree vs Hash indexes
- Covering indexes and index pushdown
- Query execution plans (EXPLAIN ANALYZE)
- N+1 problem and batch loading
- Partitioning for performance
β See notes/transactions_and_concurrency.md
- ACID deep dive with real examples
- Isolation levels: READ UNCOMMITTED β SERIALIZABLE
- Deadlock detection and prevention
- Optimistic vs pessimistic locking
Problems are tagged and categorized:
problems/
βββ easy/ # Warmup + filtering + basic joins
βββ medium/ # Window functions + subqueries + design
βββ hard/ # Recursive CTEs + optimization + system design
Tags: joins aggregation window-functions cte recursion optimization design gaps-islands top-n ranking
| # | Project | Level | Tech Stack | Key Skills |
|---|---|---|---|---|
| 01 | Library Management System | Beginner | PostgreSQL | Schema design, CRUD, basic queries |
| 02 | E-Commerce Platform | BeginnerβMid | PostgreSQL | Complex joins, inventory, orders |
| 03 | Analytics Dashboard Backend | Intermediate | PostgreSQL + Redis | Aggregations, caching, reporting |
| 04 | Social Media Platform | Advanced | PostgreSQL + MongoDB | Graph-like queries, feeds, scaling |
| 05 | HR & Payroll System (Capstone) | Advanced | PostgreSQL | Full design cycle, audit trail, analytics |
| Sheet | Contents |
|---|---|
| SQL Cheatsheet | All syntax, functions, patterns in one page |
| NoSQL Cheatsheet | MongoDB + Redis command reference |
| Top 50 SQL Questions | 50 most asked questions with model answers |
β Full instructions in SETUP.md
Quick start (Docker):
docker run --name pg-interview -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:16
docker run --name mongo-interview -p 27017:27017 -d mongo:7
docker run --name redis-interview -p 6379:6379 -d redis:7- Start with a learning path β pick the one matching your role above
- Read the module README β understand the concept + interviewer lens
- Run the SQL files β every module has runnable
.sqlscripts - Solve the problems β attempt before looking at solutions
- Build the projects β fork the project template, implement from scratch
- Review cheatsheets β last-minute revision before interviews
See CONTRIBUTING.md for guidelines on adding problems, fixing errors, or improving explanations.
MIT Β© 2024 β Free to use, fork, and build on.