Post

DBMS Fundamentals: Core Concepts Every Dev Must Know

A beginner-friendly guide to DBMS fundamentals covering keys, normalization, transactions, ACID properties, and SQL basics with clear examples.

DBMS Fundamentals: Core Concepts Every Dev Must Know

📚 DBMS Fundamentals for Data Engineers — Interview Prep Guide

1. What is a DBMS?

A Database Management System (DBMS) is software that stores, retrieves, and manages data efficiently. Think of it as a smart librarian — it knows where everything is, who can access what, and keeps things organized.

Easy mnemonic: “ACID keeps data SOLID”


2. Types of DBMS

TypeDescriptionExamplesWhen to Use
Relational (RDBMS)Tables with rows & columns, SQL-basedPostgreSQL, MySQL, OracleStructured data, OLTP
NoSQLFlexible schema (document, key-value, graph, columnar)MongoDB, Redis, Cassandra, Neo4jUnstructured/semi-structured, scale-out
NewSQLSQL + horizontal scalabilityCockroachDB, Google SpannerBest of both worlds
Columnar/OLAPColumn-oriented storageSnowflake, BigQuery, RedshiftAnalytics, Data Warehousing

3. Core Concepts (The “Big 5” Pillars)

🏛️ Pillar 1: ACID Properties

Mnemonic: “A Cat In Darkness”

PropertyMeaningReal-world Analogy
AtomicityAll or nothing — a transaction fully completes or fully rolls backBank transfer: both debit AND credit happen, or neither does
ConsistencyData moves from one valid state to anotherAccount balance can’t go negative if rules say so
IsolationConcurrent transactions don’t interfereTwo people booking the last seat — only one wins
DurabilityOnce committed, data survives crashesAfter “payment successful,” it stays even if server crashes

🏛️ Pillar 2: Normalization

Mnemonic: “No Redundant Data Allowed”

Normal FormRule (simplified)Fix
1NFNo repeating groups, atomic valuesSplit multi-value cells into rows
2NF1NF + No partial dependency (every non-key depends on the whole primary key)Move partially dependent columns to a new table
3NF2NF + No transitive dependency (non-key shouldn’t depend on another non-key)Remove columns that depend on non-key columns
BCNFEvery determinant is a candidate keyStricter version of 3NF

🎯 Data Engineer Tip: In practice, data warehouses often use denormalized schemas (Star/Snowflake) for read performance. Know when to normalize (OLTP) vs when to denormalize (OLAP).


🏛️ Pillar 3: Keys

Mnemonic: “PCFUSA” — “Please Can Friends Understand SQL Already”

KeyPurpose
Primary KeyUniquely identifies each row
Candidate KeyAll columns that could be a primary key
Foreign KeyLinks to another table’s primary key
Unique KeyLike PK but allows one NULL
Super KeyAny set of columns that uniquely identifies rows
Alternate KeyCandidate keys not chosen as PK

🏛️ Pillar 4: Joins & Set Operations

Mnemonic: Visualize a Venn Diagram

1
2
3
4
5
6
7
8
9
10
  ┌───────┐
  │  A    ∩│  B   │
  │       ││      │
  └───────┘

  INNER JOIN  = Only the intersection (∩)
  LEFT JOIN   = All of A + matching B
  RIGHT JOIN  = All of B + matching A
  FULL JOIN   = Everything from A and B
  CROSS JOIN  = Every row of A × every row of B (Cartesian product)

🏛️ Pillar 5: Indexing

Mnemonic: “Index = Book’s Table of Contents”

Index TypeHow it worksBest for
B-TreeBalanced tree, sortedRange queries, equality (WHERE age > 25)
HashHash function lookupExact match (WHERE id = 42)
BitmapBit arrays per valueLow-cardinality columns (gender, status)
CompositeMulti-column indexQueries filtering on multiple columns
ClusteredPhysically reorders dataOne per table, primary key lookups
Non-ClusteredSeparate pointer structureMultiple per table, secondary lookups

4. Data Engineer-Specific Must-Knows

📦 Schema Design Patterns

PatternUse Case
Star SchemaFact table + dimension tables (simple, fast reads)
Snowflake SchemaNormalized dimensions (saves space, more joins)
Data VaultHub + Link + Satellite (auditable, scalable for enterprise DWH)

🔄 Transactions & Concurrency Control

ConceptWhat to Know
WAL (Write-Ahead Log)Changes are logged before being applied — crash recovery
MVCCMultiple versions of data for concurrent reads without locking (PostgreSQL, Snowflake)
LockingShared (read) vs Exclusive (write) locks; know deadlocks
Isolation LevelsRead Uncommitted → Read Committed → Repeatable Read → Serializable (increasing strictness)

⚡ Query Optimization

  • EXPLAIN / EXPLAIN ANALYZE — Always check query plans
  • Partitioning — Split large tables (by date, region, etc.)
  • Sharding — Distribute data across machines
  • Materialized Views — Pre-computed query results
  • Query pushdown — Push filters close to storage (important in Spark/BigQuery)

5. CAP Theorem (Distributed Systems)

Mnemonic: “Pick 2 out of 3”

PropertyMeaning
ConsistencyEvery read gets the latest write
AvailabilityEvery request gets a response
Partition ToleranceSystem works despite network splits
  • CP: MongoDB, HBase (sacrifice availability)
  • AP: Cassandra, DynamoDB (sacrifice consistency)
  • CA: Traditional RDBMS (single-node, no partition tolerance)

6. 🎯 Interview Prep Strategy

✅ Top 20 Questions to Prepare

#Question
1What are ACID properties? Give a real-world example.
2Difference between SQL and NoSQL databases?
3Explain normalization (1NF through BCNF) with examples.
4When would you denormalize?
5Star schema vs Snowflake schema?
6What is a clustered vs non-clustered index?
7How does a B-Tree index work internally?
8Explain isolation levels with examples.
9What is MVCC?
10How do you optimize a slow SQL query?
11What is partitioning vs sharding?
12Explain the CAP theorem.
13What is a deadlock? How to prevent it?
14Difference between DELETE, TRUNCATE, and DROP?
15What are window functions? (ROW_NUMBER, RANK, LEAD/LAG)
16Explain CTEs and recursive CTEs.
17What is a materialized view vs a regular view?
18What is database replication? (Master-Slave, Master-Master)
19Explain slowly changing dimensions (SCD Type 1, 2, 3).
20What is a transaction log / WAL?

📅 7-Day Study Plan

DayFocus AreaAction
1ACID, Keys, NormalizationMemorize with examples
2SQL Joins, Subqueries, CTEsWrite 10 queries on LeetCode/HackerRank
3Indexing & Query OptimizationPractice EXPLAIN plans on a sample DB
4Schema Design (Star, Snowflake, Data Vault)Draw diagrams from scratch
5Transactions, Locking, Isolation LevelsWalk through concurrency scenarios
6CAP Theorem, Replication, ShardingCompare real databases (Postgres vs Cassandra)
7Mock InterviewAnswer all 20 questions aloud in 2 min each

🛠️ Practice Resources

  • SQL Practice: LeetCode (Database section), HackerRank SQL, StrataScratch
  • System Design: “Designing Data-Intensive Applications” by Martin Kleppmann (the bible for Data Engineers)
  • Hands-on: Set up PostgreSQL locally, load sample data, and practice EXPLAIN ANALYZE

💡 Golden Rules for Interviews

  1. Always give examples — Don’t just define; illustrate with a scenario
  2. Think aloud — Walk the interviewer through your reasoning
  3. Trade-offs matter — “It depends on…” is often the right start
  4. Know your resume — If you listed Snowflake/Spark/Redshift, you’ll be asked about it
  5. Ask clarifying questions — Great engineers don’t assume

Remember: As a Data Engineer, interviewers test you on practical application (schema design, query tuning, pipeline reliability) more than pure theory. Always tie concepts back to real-world data pipeline scenarios. Good luck! 🚀

This post is licensed under CC BY 4.0 by the author.