Domain 1 — Module 3 of 7 43%
3 of 27 overall
Domain 1: Core Data Concepts Free ⏱ ~12 min read

Databases: Relational vs Non-Relational

Files are great for sharing data, but databases are where data lives and works. Learn the fundamental difference between relational and non-relational databases.

What is a database?

Simple explanation

A database is an organised collection of data that lets you store, find, and update information quickly.

Think of it as the difference between a pile of sticky notes on your desk (files) and a well-organised filing cabinet with labelled folders (database). Both store information, but the filing cabinet lets you find things fast and keeps everything in order.

There are two big families of databases: relational (everything in neat tables) and non-relational (flexible storage for different shapes of data).

Relational databases

A relational database stores data in tables (also called relations). Each table has a fixed set of columns, and each row represents one record.

Tables are linked together through relationships — a column in one table references a column in another. This is what makes them “relational.”

Jake’s example: CloudPulse’s customer database might have:

Customers tableOrders table
CustomerID (PK)NameOrderID (PK)CustomerID (FK)
101Meridian Health5001101
102Kiwi Fitness5002101

The CustomerID column links the two tables. You can query “show me all orders for Meridian Health” by joining the tables on that shared column.

Key characteristics:

  • Data stored in tables with fixed schemas
  • Tables linked by keys (primary keys and foreign keys)
  • Queried using SQL (Structured Query Language)
  • Enforce data integrity (no orphan records, type checking)
  • Examples: Azure SQL Database, MySQL, PostgreSQL

Non-relational databases (NoSQL)

A non-relational database (often called NoSQL — “Not Only SQL”) doesn’t use tables with fixed schemas. Instead, it stores data in flexible formats depending on the use case.

There are four common types:

TypeHow It WorksExample Use Case
DocumentStores JSON-like documents. Each document can have different fields.User profiles, product catalogues
Key-valueSimple pairs: a unique key maps to a value. Ultra-fast lookups.Session data, shopping carts, caching
Column-familyGroups related columns together. Optimised for reading large datasets.IoT telemetry, time-series data
GraphStores data as nodes (entities) and edges (relationships between them).Social networks, recommendation engines

Aisha’s example: Her food app stores user profiles as documents in Azure Cosmos DB:

{
  "userId": "aisha-001",
  "name": "Aisha Mohammed",
  "favourites": ["Chicken wrap", "Flat white"],
  "dietary": ["halal"]
}

Each profile can have different fields — Liam might not have “dietary” preferences. The flexibility of document storage handles this naturally.

Relational vs non-relational databases
FeatureRelationalNon-Relational (NoSQL)
Data modelFixed tables with rows & columnsFlexible: documents, key-value, graph, or column-family
SchemaDefined upfront (rigid)Flexible or schema-on-read
Query languageSQLVaries (API calls, SQL-like dialects, query builders)
RelationshipsEnforced via foreign keys and joinsTypically embedded within documents or handled by the app
Best forTransactional systems, structured business dataFlexible data, high scale, global distribution
Azure exampleAzure SQL DatabaseAzure Cosmos DB
When to choose relational vs non-relational

Choose relational when:

  • Your data has a consistent, well-defined structure
  • You need strong data integrity and relationships between entities
  • You use complex queries with joins across multiple tables
  • Example: Tom’s delivery tracking system (orders, drivers, routes — all tightly related)

Choose non-relational when:

  • Your data shape varies between records
  • You need horizontal scaling (distribute data across regions)
  • You need ultra-fast reads/writes at massive scale
  • Example: Aisha’s user profiles (each user has different preferences)

Many modern applications use both — relational for core transactions and non-relational for flexible or high-scale workloads.

Exam tip: the 'which database' pattern

The exam frequently gives you a scenario and asks which type of database fits best. Look for these signals:

  • “Fixed schema,” “relationships between tables,” “SQL queries” → Relational
  • “Flexible schema,” “JSON documents,” “varying fields” → Non-relational (document)
  • “Fast lookups by key,” “session data,” “cache” → Non-relational (key-value)
  • “Social network,” “recommendations,” “connected entities” → Non-relational (graph)

Flashcards

Question

What are the four types of non-relational (NoSQL) databases?

Click or press Enter to reveal answer

Answer

1. Document (JSON-like records with flexible fields). 2. Key-value (simple key → value pairs for fast lookups). 3. Column-family (groups of related columns for large datasets). 4. Graph (nodes and edges for connected data).

Click to flip back

Question

What makes a relational database 'relational'?

Click or press Enter to reveal answer

Answer

Tables are linked through relationships — a column in one table (foreign key) references a column in another table (primary key). This allows you to join tables and query across related data.

Click to flip back

Question

What does NoSQL stand for?

Click or press Enter to reveal answer

Answer

'Not Only SQL' — meaning these databases can use query methods beyond traditional SQL, though some (like Cosmos DB) do support SQL-like query languages.

Click to flip back

Knowledge check

Knowledge Check

Jake's startup, CloudPulse, needs to store customer billing records. Every customer has exactly the same fields: company name, billing address, plan tier, and monthly amount. The finance team needs to run SQL reports. Which database type should Jake choose?

Knowledge Check

Aisha's food app needs to store restaurant menus. Each restaurant has different categories, items, and pricing structures — some have combo deals, others have seasonal specials. The menu format varies widely. Which database type is the BEST fit?

Next up: Transactional Workloads: Keeping Data Consistent — learn what happens when data needs to be 100% accurate, every time.