ποΈ What is a Database?
AWS storage services like S3, EBS, and EFS are great for files β images, PDFs, videos. But they don't understand how files relate to each other.
A database goes further. It stores data in a structured way so you can:
Search and retrieve info fast
Index for quicker queries
Link related data together
Manage large volumes efficiently
π Storage vs ποΈ Database
File storage (S3, EBS, EFS) β just create, read, update, delete files. No relationships understood.
Databases β understand structure and relationships.
Example: an online store has a Customers table and an Orders table. The database knows Order 5001 belongs to Customer 101 (John) β a relationship, not just two separate files.
π§© Types of Databases
Every database type has its own data model, strengths, and limits. The key exam skill: matching the right database to the right use case.
ποΈ Relational Databases (SQL)
Think of an Excel sheet β rows, columns, tables. Relational databases work the same way, but let you link tables together.
Example:
Students table has a
Department IDDepartments table also has
Department IDThat shared key connects the two

You can keep linking β Students β Subjects, and so on β using keys as the glue. This linking is why they're called relational.

π¬ SQL (Structured Query Language)
Used to insert, update, delete, and search data.
This query retrieves all students from the Students table.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SELECT * FROM Students</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,500;0,6..72,600;1,6..72,500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
.infographic-sqlrun {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f0ece4;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
--code-bg: #161b26;
--code-bg-2: #1d2433;
--code-line: #2b3140;
--code-ink: #dfe4ee;
--code-kw: #7aa2f7;
--code-id: #e0af68;
--code-punct: #7f8aa3;
}
.infographic-sqlrun[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
--code-bg: #0d1017;
--code-bg-2: #141a24;
--code-line: #232a38;
--code-ink: #e3e7ef;
--code-kw: #86aefc;
--code-id: #e8bd80;
--code-punct: #8b96ad;
}
.infographic-sqlrun {
box-sizing: border-box;
max-width: 640px;
margin: 0 auto;
background: var(--paper);
color: var(--ink);
font-family: 'Inter', system-ui, sans-serif;
}
.infographic-sqlrun *, .infographic-sqlrun *::before, .infographic-sqlrun *::after {
box-sizing: border-box;
}
.infographic-sqlrun .sr-inner {
padding: clamp(1rem, 3vw, 1.5rem) clamp(1.25rem, 5vw, 2rem);
}
/* code block */
.infographic-sqlrun .sr-code {
background: var(--code-bg);
border-radius: 10px;
overflow: hidden;
border: 1px solid var(--code-line);
}
.infographic-sqlrun .sr-code-head {
display: flex;
align-items: center;
gap: 0.4rem;
padding: 0.55rem 0.9rem;
background: var(--code-bg-2);
border-bottom: 1px solid var(--code-line);
}
.infographic-sqlrun .sr-dot {
width: 9px; height: 9px; border-radius: 50%;
background: var(--code-line);
}
.infographic-sqlrun .sr-code-label {
margin-left: 0.35rem;
font-family: 'JetBrains Mono', monospace;
font-size: 0.72rem;
color: var(--code-punct);
letter-spacing: 0.02em;
}
.infographic-sqlrun .sr-code-body {
padding: 1rem 2.2rem 1rem 1.1rem; /* extra right padding */
font-family: 'JetBrains Mono', monospace;
font-size: 0.94rem;
line-height: 1.6;
color: var(--code-ink);
white-space: pre;
overflow-x: auto;
}
.infographic-sqlrun .kw { color: var(--code-kw); font-weight: 600; }
.infographic-sqlrun .id { color: var(--code-id); }
.infographic-sqlrun .punct{ color: var(--code-punct); }
/* run button */
.infographic-sqlrun .sr-run-row {
display: flex;
align-items: center;
gap: 0.7rem;
margin-top: 0.9rem;
}
.infographic-sqlrun .sr-run-btn {
display: inline-flex;
align-items: center;
gap: 0.45rem;
font-family: 'Inter', sans-serif;
font-weight: 600;
font-size: 0.86rem;
color: #ffffff;
background: var(--accent);
border: none;
border-radius: 8px;
padding: 0.55rem 1.1rem;
cursor: pointer;
transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.infographic-sqlrun .sr-run-btn:hover { box-shadow: 0 4px 14px -6px var(--accent); }
.infographic-sqlrun .sr-run-btn:active { transform: translateY(1px); }
.infographic-sqlrun .sr-run-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.infographic-sqlrun .sr-run-btn[disabled] { opacity: 0.6; cursor: default; }
.infographic-sqlrun .sr-run-btn svg { flex: none; }
.infographic-sqlrun .sr-status {
font-family: 'JetBrains Mono', monospace;
font-size: 0.76rem;
color: var(--ink-soft);
opacity: 0;
transition: opacity 0.2s ease;
}
.infographic-sqlrun .sr-status.show { opacity: 1; }
/* output */
.infographic-sqlrun .sr-output {
margin-top: 1.4rem;
max-height: 0;
opacity: 0;
overflow: hidden;
transition: max-height 0.45s ease, opacity 0.35s ease;
}
.infographic-sqlrun .sr-output.show {
max-height: 400px;
opacity: 1;
}
.infographic-sqlrun .sr-output-label {
font-family: 'Newsreader', serif;
font-style: italic;
font-size: 0.95rem;
color: var(--ink-soft);
margin: 0 0 0.55rem;
}
.infographic-sqlrun table {
width: 100%;
border-collapse: collapse;
border: 1px solid var(--line);
border-radius: 10px;
overflow: hidden;
font-size: 0.86rem;
}
.infographic-sqlrun thead th {
text-align: left;
background: var(--accent);
color: #ffffff;
font-weight: 600;
padding: 0.55rem 0.8rem;
white-space: nowrap;
}
.infographic-sqlrun tbody td {
padding: 0.55rem 0.8rem;
border-top: 1px solid var(--line);
color: var(--ink);
white-space: nowrap;
}
.infographic-sqlrun tbody tr:nth-child(odd) td { background: var(--paper-alt); }
.infographic-sqlrun tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-alt) 45%, var(--paper)); }
.infographic-sqlrun .sr-meta {
margin-top: 0.55rem;
font-family: 'JetBrains Mono', monospace;
font-size: 0.72rem;
color: var(--ink-soft);
}
@media (prefers-reduced-motion: reduce) {
.infographic-sqlrun .sr-output,
.infographic-sqlrun .sr-run-btn,
.infographic-sqlrun .sr-status {
transition: none;
}
}
@media (max-width: 480px) {
.infographic-sqlrun table { font-size: 0.76rem; }
.infographic-sqlrun thead th, .infographic-sqlrun tbody td { padding: 0.5rem 0.55rem; }
.infographic-sqlrun .sr-code-body { font-size: 0.84rem; padding-right: 1.4rem; }
}
</style>
</head>
<body>
<div class="infographic-sqlrun">
<div class="sr-inner">
<div class="sr-code">
<div class="sr-code-head">
<span class="sr-dot"></span><span class="sr-dot"></span><span class="sr-dot"></span>
<span class="sr-code-label">query.sql</span>
</div>
<div class="sr-code-body"><span class="kw">SELECT</span> <span class="punct">*</span> <span class="kw">FROM</span> <span class="id">Students</span><span class="punct">;</span></div>
</div>
<div class="sr-run-row">
<button class="sr-run-btn" id="sr-run-btn" type="button">
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M2 1.2v9.6a.6.6 0 0 0 .92.5l7.7-4.8a.6.6 0 0 0 0-1L2.92.7A.6.6 0 0 0 2 1.2Z"/></svg>
<span id="sr-run-label">Run</span>
</button>
<span class="sr-status" id="sr-status">Executingβ¦</span>
</div>
<div class="sr-output" id="sr-output">
<p class="sr-output-label">Output</p>
<table>
<thead>
<tr><th>Student ID</th><th>Dept ID</th><th>Name</th><th>Email</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>M01</td><td>Joe Miller</td><td>joe@abc.com</td></tr>
<tr><td>2</td><td>B01</td><td>Sarah T</td><td>sarah@abc.com</td></tr>
</tbody>
</table>
<p class="sr-meta" id="sr-meta">2 rows returned</p>
</div>
</div>
</div>
<script>
(function () {
const wrapper = document.currentScript.closest('.infographic-sqlrun')
|| document.querySelector('.infographic-sqlrun');
const bodyAttr = document.body.getAttribute('data-darkmode');
let dark;
if (bodyAttr === 'true') {
dark = true;
} else if (bodyAttr === 'false') {
dark = false;
} else {
const match = document.cookie.match(/(?:^|;\s*)darkMode=([^;]+)/);
dark = match ? match[1] === 'true' : false;
}
if (dark) wrapper.setAttribute('data-theme', 'dark');
const btn = document.getElementById('sr-run-btn');
const label = document.getElementById('sr-run-label');
const status = document.getElementById('sr-status');
const output = document.getElementById('sr-output');
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
btn.addEventListener('click', function () {
btn.setAttribute('disabled', 'true');
label.textContent = 'Runningβ¦';
status.textContent = 'Executingβ¦';
status.classList.add('show');
output.classList.remove('show');
const delay = reduced ? 0 : 450;
setTimeout(function () {
output.classList.add('show');
label.textContent = 'Run again';
status.textContent = 'Done Β· 2 rows in 12ms';
btn.removeAttribute('disabled');
}, delay);
});
})();
</script>
</body>
</html>π§ Exam tip: See "SQL" β think Relational Database.
π NoSQL Databases & Why use NoSQL
NoSQL = "Not Only SQL." No fixed tables β built for flexibility and scale.
1. π Flexible schema
Data can be nested (like JSON), and fields can change over time β no rigid table structure.
{
"name": "John",
"address": { "city": "Nairobi", "country": "Kenya" },
"cars": ["Ford", "BMW"]
}
2. π Easier scaling
Relational DBs scale vertically β bigger server
NoSQL scales horizontally β more servers
3. β‘ High performance
Optimized for specific workloads β fast, distributed, purpose-built.
π NoSQL Flavors
Type | Icon | Best for |
|---|---|---|
Key-Value | π | Simple lookups ( |
Document | π | JSON-style nested records |
Graph | π | Relationships (social networks, recommendations) |
In-Memory | β‘ | Caching, real-time speed |
Search | π | Logs, analytics, full-text search |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AWS Managed Databases</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,500;0,6..72,600;1,6..72,500&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
.infographic-awsdb {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f0ece4;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
--neg-ink: #b3261e;
--neg-tint: #fbe6e4;
}
.infographic-awsdb[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
--neg-ink: #f2867e;
--neg-tint: #3a1f1f;
}
.infographic-awsdb {
box-sizing: border-box;
max-width: 880px;
margin: 0 auto;
background: var(--paper);
color: var(--ink);
font-family: 'Inter', system-ui, sans-serif;
}
.infographic-awsdb *, .infographic-awsdb *::before, .infographic-awsdb *::after {
box-sizing: border-box;
}
.infographic-awsdb .aw-inner {
padding: clamp(1.25rem, 4vw, 2rem) clamp(1.25rem, 5vw, 3rem);
}
.infographic-awsdb h1 {
font-family: 'Newsreader', serif;
font-weight: 600;
font-size: clamp(1.4rem, 3.4vw, 1.85rem);
margin: 0 0 0.35rem;
display: flex;
align-items: center;
gap: 0.45rem;
}
.infographic-awsdb .aw-sub {
font-size: 0.9rem;
color: var(--ink-soft);
margin: 0 0 1.4rem;
max-width: 56ch;
}
/* tabs */
.infographic-awsdb .aw-tabs {
display: inline-flex;
gap: 0.35rem;
background: var(--paper-alt);
padding: 0.3rem;
border-radius: 999px;
margin-bottom: 1.6rem;
}
.infographic-awsdb .aw-tab {
font-family: 'Inter', sans-serif;
font-weight: 600;
font-size: 0.82rem;
color: var(--ink-soft);
background: transparent;
border: none;
padding: 0.5rem 1rem;
border-radius: 999px;
cursor: pointer;
transition: background 0.2s ease, color 0.2s ease;
}
.infographic-awsdb .aw-tab[aria-selected="true"] {
background: var(--accent);
color: #ffffff;
}
.infographic-awsdb .aw-tab:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.infographic-awsdb .aw-panel { display: none; }
.infographic-awsdb .aw-panel.active { display: block; }
/* benefits grid */
.infographic-awsdb .aw-benefits {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.7rem;
margin-bottom: 1.6rem;
}
.infographic-awsdb .aw-benefit {
background: var(--paper-alt);
border-radius: 10px;
padding: 0.8rem 0.85rem;
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.infographic-awsdb .aw-benefit .icon {
font-size: 1.15rem;
line-height: 1;
}
.infographic-awsdb .aw-benefit .label {
font-size: 0.82rem;
font-weight: 600;
color: var(--ink);
line-height: 1.3;
}
.infographic-awsdb .aw-benefit .detail {
font-size: 0.74rem;
color: var(--ink-soft);
line-height: 1.3;
}
/* shared responsibility split */
.infographic-awsdb .aw-split-label {
font-family: 'Newsreader', serif;
font-style: italic;
font-size: 0.95rem;
color: var(--ink-soft);
margin: 0 0 0.6rem;
}
.infographic-awsdb .aw-split {
display: grid;
grid-template-columns: 1fr 1fr;
border: 1px solid var(--line);
border-radius: 10px;
overflow: hidden;
}
.infographic-awsdb .aw-split-col {
padding: 0.9rem 1rem;
}
.infographic-awsdb .aw-split-col:first-child {
border-right: 1px solid var(--line);
background: var(--accent-soft);
}
.infographic-awsdb .aw-split-col:last-child {
background: var(--paper-alt);
}
.infographic-awsdb .aw-split-head {
font-weight: 700;
font-size: 0.8rem;
margin: 0 0 0.55rem;
display: flex;
align-items: center;
gap: 0.4rem;
}
.infographic-awsdb .aw-split-col:first-child .aw-split-head { color: var(--accent); }
.infographic-awsdb .aw-split-col:last-child .aw-split-head { color: var(--ink-soft); }
.infographic-awsdb .aw-split ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.infographic-awsdb .aw-split li {
font-size: 0.8rem;
color: var(--ink);
}
/* self-managed panel */
.infographic-awsdb .aw-selfmanaged-intro {
font-size: 0.88rem;
color: var(--ink);
margin: 0 0 1rem;
max-width: 56ch;
}
.infographic-awsdb .aw-chip-row {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-bottom: 1.3rem;
}
.infographic-awsdb .aw-chip {
display: inline-flex;
align-items: center;
gap: 0.35rem;
background: var(--neg-tint);
color: var(--neg-ink);
font-weight: 600;
font-size: 0.8rem;
padding: 0.4rem 0.75rem;
border-radius: 999px;
}
.infographic-awsdb .aw-takeaway {
padding: 0.9rem 1.05rem;
background: var(--paper-alt);
border-left: 3px solid var(--accent);
border-radius: 8px;
font-size: 0.86rem;
color: var(--ink);
}
@media (max-width: 620px) {
.infographic-awsdb .aw-benefits { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
.infographic-awsdb .aw-benefits { grid-template-columns: 1fr; }
.infographic-awsdb .aw-split { grid-template-columns: 1fr; }
.infographic-awsdb .aw-split-col:first-child { border-right: none; border-bottom: 1px solid var(--line); }
}
</style>
</head>
<body>
<div class="infographic-awsdb">
<div class="aw-inner">
<h1>βοΈ AWS Managed Databases</h1>
<p class="aw-sub">A managed database means AWS runs the infrastructure β you focus on the app.</p>
<div class="aw-tabs" role="tablist">
<button class="aw-tab" id="tab-managed" role="tab" aria-selected="true" aria-controls="panel-managed" type="button">π Managed Service</button>
<button class="aw-tab" id="tab-self" role="tab" aria-selected="false" aria-controls="panel-self" type="button">π₯οΈ Self-Managed on EC2</button>
</div>
<div class="aw-panel active" id="panel-managed" role="tabpanel" aria-labelledby="tab-managed">
<div class="aw-benefits">
<div class="aw-benefit"><span class="icon">β‘</span><span class="label">Fast deployment</span><span class="detail">Spin up in minutes</span></div>
<div class="aw-benefit"><span class="icon">π’</span><span class="label">High availability</span><span class="detail">Failover, Multi-AZ, replication</span></div>
<div class="aw-benefit"><span class="icon">π</span><span class="label">Easy scaling</span><span class="detail">Vertical or horizontal</span></div>
<div class="aw-benefit"><span class="icon">πΎ</span><span class="label">Automated backups</span><span class="detail">Including point-in-time recovery</span></div>
<div class="aw-benefit"><span class="icon">π§</span><span class="label">Auto maintenance</span><span class="detail">Patches and upgrades handled</span></div>
<div class="aw-benefit"><span class="icon">π</span><span class="label">Monitoring</span><span class="detail">Built-in CloudWatch integration</span></div>
</div>
<p class="aw-split-label">βοΈ Shared Responsibility</p>
<div class="aw-split">
<div class="aw-split-col">
<p class="aw-split-head">AWS handles</p>
<ul>
<li>Hardware & infrastructure</li>
<li>OS patching</li>
<li>DB maintenance</li>
<li>Availability</li>
<li>Backups</li>
</ul>
</div>
<div class="aw-split-col">
<p class="aw-split-head">You handle</p>
<ul>
<li>DB configuration</li>
<li>Data security</li>
<li>User permissions</li>
<li>Network settings</li>
<li>App usage</li>
</ul>
</div>
</div>
</div>
<div class="aw-panel" id="panel-self" role="tabpanel" aria-labelledby="tab-self">
<p class="aw-selfmanaged-intro">Running MySQL / PostgreSQL / MongoDB yourself on EC2? You own everything:</p>
<div class="aw-chip-row">
<span class="aw-chip">β Install</span>
<span class="aw-chip">β Backups</span>
<span class="aw-chip">β HA</span>
<span class="aw-chip">β Scaling</span>
<span class="aw-chip">β Patches</span>
<span class="aw-chip">β Disaster recovery</span>
</div>
<div class="aw-takeaway">That's a lot of overhead β which is exactly why managed services exist.</div>
</div>
</div>
</div>
<script>
(function () {
const wrapper = document.currentScript.closest('.infographic-awsdb')
|| document.querySelector('.infographic-awsdb');
const bodyAttr = document.body.getAttribute('data-darkmode');
let dark;
if (bodyAttr === 'true') {
dark = true;
} else if (bodyAttr === 'false') {
dark = false;
} else {
const match = document.cookie.match(/(?:^|;\s*)darkMode=([^;]+)/);
dark = match ? match[1] === 'true' : false;
}
if (dark) wrapper.setAttribute('data-theme', 'dark');
const tabs = wrapper.querySelectorAll('.aw-tab');
tabs.forEach(function (tab) {
tab.addEventListener('click', function () {
tabs.forEach(function (t) {
t.setAttribute('aria-selected', 'false');
wrapper.querySelector('#' + t.getAttribute('aria-controls')).classList.remove('active');
});
tab.setAttribute('aria-selected', 'true');
wrapper.querySelector('#' + tab.getAttribute('aria-controls')).classList.add('active');
});
});
})();
</script>
</body>
</html>