Beyond Tables: NoSQL Databases
Relational databases are not the only kind. NoSQL databases drop the fixed table layout, usually to scale across many servers or to fit awkward data. The main families:
| Type | Stores | Example use | Examples |
|---|---|---|---|
| Key-value | A value found by its key | Sessions, caches | Redis |
| Document | Flexible JSON-like documents | Product catalogues, content | MongoDB |
| Column family | Wide rows grouped by column | Huge event logs | Cassandra |
| Graph | Nodes and links between them | Social networks, recommendations | Neo4j |
NoSQL is a tool, not an upgrade. Relational databases remain the best fit when data is structured, relationships matter and consistency is vital.
Examplepython
Quick check
Which type of database stores things by key, like a dictionary?
Your turn: write the code
From the list of documents, print the names of the products that have a 'tags' field, as a list.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.