8. SQL vs NoSQL
1
The picture to keep in your head2
8.1 What are tables, rows and keys?3
8.2 What does ACID mean?4
8.3 What is normalisation, and what are joins?5
8.4 What kinds of NoSQL databases are there?6
8.5 What's the difference between schema-on-write and schema-on-read?7
8.6 Why does NoSQL often duplicate data and avoid joins?8
8.7 How do you choose between SQL and NoSQL?9
Memory card and where the analogy breaks10
Practice: five levels11
Interview questions12
Solutions13
Sources14
Code lab8. SQL vs NoSQL
Sources
3 min read+10 XP
Source notes
- ACID: the term was introduced by Theo Härder and Andreas Reuter, "Principles of Transaction-Oriented Database Recovery", ACM Computing Surveys, 1983.
- Normal forms: E. F. Codd's relational model papers (1970 onward).
- Wide-column design: Fay Chang et al., "Bigtable: A Distributed Storage System for Structured Data", OSDI 2006; Apache Cassandra documentation (partition keys and clustering columns).
- Key-value at scale: Giuseppe DeCandia et al., "Dynamo: Amazon's Highly Available Key-value Store", SOSP 2007.
- PostgreSQL JSON support (
jsonandjsonbtypes): PostgreSQL documentation. - Transactions in NoSQL databases: for example, MongoDB multi-document transactions and DynamoDB transactions, per their official documentation.
- SQLite enforces foreign keys only when
PRAGMA foreign_keys = ONis set: SQLite documentation. - Level 2 numbers are illustrative assumptions; arithmetic computed 2026-10-08.
- Level 3 and Level 4 code: tested 2026-10-08 (
code/ch08_sql_nosql.py, all checks pass).