Choosing the Right Database
NoSQL and Choosing per Dataset 🗄️
The last lesson showed what a relational database gives you: a fixed structure, enforced up front, and transactions that either fully succeed or fully fail. That is a good fit for payments, but not every dataset behaves like a payment.
In this lesson, you will learn to:
- Tell apart document, key-value, wide-column, and graph databases by the shape of data each is built for.
- Name major managed NoSQL services and the workloads they support.
- Decide when to split data across relational and NoSQL stores instead of forcing every dataset into one database.
Flexible Structure: Document, Key-Value, Wide-Column, and Graph 🧩
NoSQL is an umbrella term for databases that don't use the fixed table-and-schema model. The name is a little misleading. It doesn't mean "no structure" and it doesn't mean these databases are hostile to SQL. It means the structure isn't declared in advance and enforced on every write. Instead, each record can carry whatever fields it needs, and the application decides what those fields mean.
There are four families you'll hear named, and it helps to think of them by the shape of the data they hold.
A document database stores one self-contained record per item, usually written in a format like JSON, which is just text organized into labeled fields. Two records in the same collection can have different fields. One patient's intake questionnaire might have twelve answers, another's forty, and neither has to match a predefined column list. That's a good fit for content whose fields keep evolving.
A key-value store is the simplest of all: you hand it an identifier, it hands you back a value, extremely fast. Think of a coat check. You give the ticket number, you get the coat. No searching, no joining tables. Shopping carts, user sessions, and device readings looked up by device number all live here.
A wide-column store is built for enormous tables where different rows can hold different columns. It's designed for the case where you have billions of rows and you almost always read them by a known identifier and a time range, such as sensor readings over the last hour.
A graph database stores the connections between things as first-class data. Its natural questions are relationship questions: who is connected to whom, and by how many hops. Fraud rings, referral networks, and recommendation systems are the usual examples.
The common thread across all four is that structure is loosened in exchange for something else, usually speed at very large scale, or the freedom to store records that don't all look alike.

The comparison makes the decision practical: begin with the data shape and the question the application needs to answer, rather than treating NoSQL as one interchangeable category.
