Knowledge Guide
HomeDatabases

🔎 Pattern Recognition — Databases

Read a problem, spot the signal, pick the technique — your triage map for Databases.

How to use this guide: read the problem statement, scan for the signals below, and jump to the technique each one points at. Signals are grouped by the decision they resolve — storage choice first, then schema design, then query construction.

Signal group 1 — "Do I even need a database?" (storage choice)

Signal group 2 — "How do I structure the data?" (schema design)

Signal group 3 — "Is my schema redundant?" (normalization)

Signal group 4 — "How do I write the query?" (SQL construction)

Triage order — what to try, in sequence:

  1. Decide storage. Is a database even warranted (durability / concurrency / querying / transactions), or do files suffice? If a DB, is it relational? (Foundations, Database)
  2. Model conceptually. If asked to "design," do the noun/verb ER scan first, then map entities → tables. (Data Modeling, ER Models, Relational Model)
  3. State the constraints. Write the functional dependencies and pin down PRIMARY/FOREIGN keys. (Functional Dependency, Relational Model)
  4. Normalize (or knowingly denormalize). Drive out anomalies via 1NF→3NF/BCNF for OLTP; denormalize only for read-heavy/NoSQL cases. (Normalization, Data Modeling)
  5. Write the query. Map the grouping key, choose GROUP BY + aggregate, place row-filters in WHERE and group-filters in HAVING, and add the right JOIN type. (SQL Fundamentals, SQL Practice Problems)