Goal: “In theory, there is no difference between theory and practice. In practice, there is.” — SQL is one of those topics where reading about JOINs means nothing until we write 20 queries. This week we get our hands dirty with real SQL.
Topics
| Day | Track | Focus | Topics |
|---|---|---|---|
| Mon | A — DSA Practice | Greedy & Backtracking | Solve 2-3 problems. Try activity selection, jump game, or subset generation. |
| Tue | B — DBMS | SQL Querying | DDL, DML, and DCL · Joins · Subqueries and CTEs · Aggregations, GROUP BY, and HAVING |
| Wed | A — DSA Practice | Intervals & Binary Search | Solve 2-3 problems. Merge intervals, insert interval, and binary search on answer variants. |
| Thu | B — DBMS | Advanced SQL & Modeling | Window Functions · Views and Materialized Views · Stored Procedures and Triggers · ER Diagrams |
| Fri | B — DBMS | Schema Design | Normalization · Denormalization · Relationships and Keys · Schema Design Patterns · Database Migrations |
Key Concepts
- JOINs are the most asked SQL topic in interviews — know INNER, LEFT, RIGHT, FULL, CROSS, and SELF joins cold. Draw Venn diagrams if it helps, but understand that JOINs are really about combining rows based on a condition.
- Window functions (
ROW_NUMBER,RANK,DENSE_RANK,LAG,LEAD) are increasingly popular in interviews. They let us compute across rows without collapsing the result set likeGROUP BYdoes. - CTEs (Common Table Expressions) make complex queries readable. Recursive CTEs are especially useful for hierarchical data (org charts, category trees).
- Normalization reduces data redundancy — aim for 3NF in most cases. Denormalization is the intentional reversal for read performance. Neither is “better” — it depends on the use case.
- ER diagrams are how we communicate schema design visually. Get comfortable drawing entities, relationships, and cardinality (1:1, 1:N, M:N).
Practice
- DSA: Solve 5-6 problems this week — greedy, backtracking, and interval problems
- DBMS: Write 5 SQL queries using different types of JOINs (at least one self-join and one with a subquery)
- DBMS: Write 3 queries using window functions — ranking, running totals, and comparing with previous rows
- DBMS: Design an ER diagram for a simple e-commerce system (users, products, orders, reviews) and normalize it to 3NF
~13 topics + DSA practice · ~2 hrs/day · Dual-track: DBMS SQL + DSA coding