Skip to content

HSDevCraft/database-deep-dive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—„οΈ Database Interview Prep

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.

SQL NoSQL License Modules Problems


πŸ“‹ Table of Contents


🎯 Why This Course

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


πŸ“ Repository Structure

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

πŸ›€οΈ Learning Paths

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

πŸ”· SQL Mastery

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 ⭐⭐⭐⭐⭐

πŸ—οΈ Database Design

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

πŸƒ NoSQL & Distributed Systems

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 ⭐⭐⭐⭐⭐

⚑ Performance Optimization

β†’ 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

πŸ” Transactions & Concurrency

β†’ 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

πŸ§ͺ Problem Bank

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


πŸ’Ό Projects

# 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

πŸ“– Cheatsheets

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

βš™οΈ Setup Guide

β†’ 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

πŸ“Œ How to Use This Repo

  1. Start with a learning path β€” pick the one matching your role above
  2. Read the module README β€” understand the concept + interviewer lens
  3. Run the SQL files β€” every module has runnable .sql scripts
  4. Solve the problems β€” attempt before looking at solutions
  5. Build the projects β€” fork the project template, implement from scratch
  6. Review cheatsheets β€” last-minute revision before interviews

🀝 Contributing

See CONTRIBUTING.md for guidelines on adding problems, fixing errors, or improving explanations.


πŸ“„ License

MIT Β© 2024 β€” Free to use, fork, and build on.

About

Database concepts deep dive along with implementations

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors