A Relational Database is a type of database that stores data in the form of tables (relations) consisting of rows (records) and columns (attributes).
It uses Structured Query Language (SQL) to manage and query data.
It is based on E.F. Codd’s relational model (1970), where data is organized into interconnected tables, and relationships are maintained using primary keys and foreign keys.
Primary Key: Uniquely identifies each row (e.g.,
ID)Foreign Key: Links one table to another (e.g.,
Deptin Students referencesDepartments)
🔧 Core Features of RDBMS
Feature | Description |
|---|---|
📐 Structured Schema | Tables have predefined structure |
📎 Data Integrity | Enforced via constraints (PK, FK, UNIQUE, NOT NULL) |
🔗 Relationships | Built using joins and foreign keys |
🧪 ACID Properties | Ensures reliable transactions |
🔍 Powerful Queries | SQL supports filtering, sorting, joining, aggregating |
✅ Advantages of Relational Databases
Advantage | Description |
|---|---|
✅ Data Integrity | Enforced rules ensure valid data |
✅ Strong Consistency | ACID-compliant transactions |
✅ Easy Relationships | Natural for modeling linked data |
✅ Standardized Language | SQL is widely known and used |
✅ Security Features | Role-based access control, encryption, etc. |
❌ Disadvantages of Relational Databases
Disadvantage | Description |
|---|---|
❌ Scalability Limits | Vertical scaling (hard to distribute) |
❌ Fixed Schema | Inflexible for changing data models |
❌ Performance Overhead | Joins and normalization slow for big data |
❌ Not Ideal for Unstructured Data | Binary, multimedia, or nested objects |
🧰 Examples of RDBMS Software
Database | Description |
|---|---|
MySQL | Open-source, widely used in web apps |
PostgreSQL | Advanced features, ACID-compliant |
Oracle DB | Enterprise-grade, powerful and secure |
SQL Server | Microsoft's RDBMS, good for enterprise use |
SQLite | Lightweight, file-based, used in mobile apps |
📍 Use Cases
Use Case | Reason |
|---|---|
💳 Banking/Finance | High consistency and transactional support |
📊 Enterprise Applications | Inventory, payroll, HRMS |
🧾 Invoicing/Billing Systems | Relational structure suits record-keeping |
🏫 School/College Databases | Student/course/teacher relationships |
🔁 Relational vs Non-Relational (Quick Look)
Feature | Relational (SQL) | Non-Relational (NoSQL) |
|---|---|---|
Data Model | Tables (rows/columns) | Documents, key-value, etc. |
Schema | Fixed | Flexible / schema-less |
Scaling | Vertical (scale-up) | Horizontal (scale-out) |
Transactions | Full ACID support | Often eventual consistency |
Best For | Structured, relational | Unstructured, scalable |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>What Is a Relational Database?</title>
<style>
.infographic-relationaldb {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f0ece4;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
--good: #16a34a;
--good-soft: #dcfce7;
--on-accent: #ffffff;
--display-font: Georgia, 'Iowan Old Style', serif;
--body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
--mono-font: 'SF Mono', Consolas, monospace;
background: var(--paper);
color: var(--ink);
font-family: var(--body-font);
max-width: 960px;
margin: 0 auto;
box-sizing: border-box;
overflow-x: hidden;
}
.infographic-relationaldb[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
--good: #4ade80;
--good-soft: #123420;
--on-accent: #101418;
}
.infographic-relationaldb * { box-sizing: border-box; }
.rd-head { text-align: center; margin-bottom: 0.25rem; }
.rd-head h2 {
font-family: var(--display-font);
font-size: 2rem;
margin: 0 0 0.5rem;
}
.rd-head p {
color: var(--ink-soft);
font-size: 1rem;
margin: 0 auto;
max-width: 600px;
line-height: 1.55;
}
/* ---- Part A: chaos to order ---- */
.rd-frame {
background: var(--paper-alt);
border: 1px solid var(--line);
border-radius: 10px;
padding: 1.25rem;
margin-top: 1.75rem;
}
.rd-frame-title { font-family: var(--display-font); font-size: 1.05rem; margin: 0 0 0.4rem; text-align: center; }
.rd-frame-desc { font-size: 0.87rem; color: var(--ink-soft); line-height: 1.5; margin: 0 0 1rem; text-align: center; }
.rd-chaos-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rd-chaos-stage {
position: relative;
height: 260px;
min-width: 460px;
background: var(--paper);
border: 1px dashed var(--line);
border-radius: 8px;
overflow: hidden;
}
.rd-chaos-stage.is-organized { border-style: solid; border-color: var(--accent); }
.rd-grid-lines { position: absolute; inset: 0; opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.rd-chaos-stage.is-organized .rd-grid-lines { opacity: 1; }
.rd-grid-line { position: absolute; background: var(--line); }
.rd-header-row { position: absolute; display: flex; opacity: 0; transition: opacity 0.4s 0.6s; pointer-events: none; }
.rd-chaos-stage.is-organized .rd-header-row { opacity: 1; }
.rd-header-cell {
width: 130px;
font-size: 0.7rem;
font-weight: 700;
color: var(--on-accent);
background: var(--accent);
padding: 0.3rem 0.5rem;
text-align: center;
}
.rd-chip {
position: absolute;
background: var(--accent-soft);
color: var(--accent);
border: 1px solid var(--accent);
border-radius: 6px;
padding: 0.35rem 0.6rem;
font-family: var(--mono-font);
font-size: 0.78rem;
font-weight: 600;
width: 110px;
text-align: center;
animation: rd-float 3.2s ease-in-out infinite;
transition: left 0.7s cubic-bezier(.34,1.4,.64,1), top 0.7s cubic-bezier(.34,1.4,.64,1), transform 0.7s ease, border-radius 0.4s;
}
.rd-chaos-stage.is-organized .rd-chip {
animation: none;
border-radius: 0;
background: var(--paper);
color: var(--ink);
border-color: var(--line);
}
@keyframes rd-float {
0%, 100% { margin-top: 0px; }
50% { margin-top: -8px; }
}
.rd-organize-row { display: flex; justify-content: center; gap: 0.6rem; margin-top: 1.1rem; }
.rd-organize-btn {
font: inherit;
font-size: 0.88rem;
background: var(--accent);
color: var(--on-accent);
border: none;
border-radius: 7px;
padding: 0.6rem 1.3rem;
cursor: pointer;
}
.rd-organize-btn:hover { opacity: 0.9; }
.rd-organize-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rd-reset-mini-btn {
font: inherit;
font-size: 0.82rem;
background: var(--paper);
border: 1px solid var(--line);
border-radius: 7px;
padding: 0.6rem 1rem;
cursor: pointer;
color: var(--ink);
display: none;
}
.rd-reset-mini-btn.is-visible { display: inline-block; }
.rd-reset-mini-btn:hover { border-color: var(--accent); }
.rd-reveal-line {
text-align: center;
font-size: 0.9rem;
color: var(--good);
margin-top: 1rem;
opacity: 0;
transition: opacity 0.5s 1s;
}
.rd-reveal-line.is-visible { opacity: 1; }
/* ---- Part B: connected tables ---- */
.rd-tables-row {
display: flex;
align-items: center;
gap: 0;
margin-top: 0.5rem;
min-width: 0;
}
.rd-table-scroll-wrap { flex: 1; min-width: 0; overflow-x: auto; }
table.rd-table {
width: 100%;
min-width: 150px;
border-collapse: collapse;
background: var(--paper);
border-radius: 8px;
font-size: 0.8rem;
}
table.rd-table th, table.rd-table td {
border: 1px solid var(--line);
padding: 0.4rem 0.55rem;
text-align: left;
white-space: nowrap;
transition: background 0.2s, color 0.2s;
}
table.rd-table th { background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 0.7rem; }
table.rd-table tbody tr { cursor: pointer; }
table.rd-table tr.is-linked td { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.rd-connector {
flex-shrink: 0;
width: 46px;
height: 3px;
position: relative;
background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 12px);
background-size: 24px 3px;
animation: rd-flow 0.8s linear infinite;
}
@keyframes rd-flow { from { background-position-x: 0; } to { background-position-x: -24px; } }
.rd-table-name { font-size: 0.75rem; color: var(--ink-soft); text-align: center; margin: 0 0 0.4rem; }
@media (max-width: 700px) {
.rd-tables-row { flex-direction: column; }
.rd-table-scroll-wrap { width: 100%; align-self: stretch; -webkit-overflow-scrolling: touch; }
.rd-connector { width: 3px; height: 30px; background: repeating-linear-gradient(180deg, var(--accent) 0 6px, transparent 6px 12px); background-size: 3px 24px; animation: rd-flow-v 0.8s linear infinite; }
@keyframes rd-flow-v { from { background-position-y: 0; } to { background-position-y: -24px; } }
}
@media (prefers-reduced-motion: reduce) {
.infographic-relationaldb *, .infographic-relationaldb *::before, .infographic-relationaldb *::after {
transition-duration: 0.001ms !important;
animation-duration: 0.001ms !important;
}
}
</style>
</head>
<body>
<div class="infographic-relationaldb" id="relationaldb">
<div class="rd-head">
<h2>What Is a Relational Database?</h2>
<p>Loose facts scattered everywhere become useful once they're organized into rows and columns — and linked together by shared keys.</p>
</div>
<div class="rd-frame">
<p class="rd-frame-title">From chaos to structure</p>
<p class="rd-frame-desc">This is raw, unorganized data about students. Watch what "relational" actually means.</p>
<div class="rd-chaos-scroll">
<div class="rd-chaos-stage" id="rdStage">
<div class="rd-grid-lines" id="rdGridLines"></div>
<div class="rd-header-row" id="rdHeaderRow" style="left:30px; top:16px;">
<div class="rd-header-cell">StudentID</div>
<div class="rd-header-cell">Name</div>
<div class="rd-header-cell">Age</div>
</div>
<!-- chips injected by JS -->
</div>
</div>
<div class="rd-organize-row">
<button class="rd-organize-btn" id="rdOrganizeBtn" type="button">🔀 Organize the data</button>
<button class="rd-reset-mini-btn" id="rdChaosReset" type="button">↺ Scatter again</button>
</div>
<p class="rd-reveal-line" id="rdRevealLine">✔️ That's it — a table is just organized data. "Relational" is what happens next: linking tables like this one together.</p>
</div>
<div class="rd-frame">
<p class="rd-frame-title">Tables, linked by keys</p>
<p class="rd-frame-desc">Click a Student to see exactly which Enrollment and Course rows connect to them.</p>
<div class="rd-tables-row">
<div class="rd-table-scroll-wrap">
<p class="rd-table-name">Students</p>
<table class="rd-table" id="rdStudents">
<thead><tr><th>ID</th><th>Name</th></tr></thead>
<tbody>
<tr data-student="101"><td>101</td><td>Alice</td></tr>
<tr data-student="102"><td>102</td><td>Bob</td></tr>
</tbody>
</table>
</div>
<div class="rd-connector"></div>
<div class="rd-table-scroll-wrap">
<p class="rd-table-name">Enrollment</p>
<table class="rd-table" id="rdEnrollment">
<thead><tr><th>SID</th><th>CID</th></tr></thead>
<tbody>
<tr data-student="101" data-course="C1"><td>101</td><td>C1</td></tr>
<tr data-student="102" data-course="C2"><td>102</td><td>C2</td></tr>
</tbody>
</table>
</div>
<div class="rd-connector"></div>
<div class="rd-table-scroll-wrap">
<p class="rd-table-name">Courses</p>
<table class="rd-table" id="rdCourses">
<thead><tr><th>ID</th><th>Name</th></tr></thead>
<tbody>
<tr data-course="C1"><td>C1</td><td>Math</td></tr>
<tr data-course="C2"><td>C2</td><td>Physics</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
(function () {
const wrapper = document.getElementById('relationaldb');
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');
})();
/* ---- Part A: chaos to order ---- */
(function () {
const stage = document.getElementById('rdStage');
const organizeBtn = document.getElementById('rdOrganizeBtn');
const chaosReset = document.getElementById('rdChaosReset');
const revealLine = document.getElementById('rdRevealLine');
const gridLines = document.getElementById('rdGridLines');
const data = [
['101', 'Alice', '24'],
['102', 'Bob', '22'],
['103', 'Carol', '26']
];
const colX = [30, 160, 290];
const rowY = [56, 100, 144];
let chips = [];
function randomPos() {
const stageW = stage.clientWidth || 600;
const stageH = 260;
return {
left: Math.random() * (stageW - 130) + 5,
top: Math.random() * (stageH - 100) + 60,
rot: (Math.random() * 30 - 15).toFixed(1)
};
}
function buildChips() {
stage.querySelectorAll('.rd-chip').forEach(c => c.remove());
chips = [];
data.forEach((row, r) => {
row.forEach((val, c) => {
const chip = document.createElement('div');
chip.className = 'rd-chip';
chip.textContent = val;
const pos = randomPos();
chip.style.left = pos.left + 'px';
chip.style.top = pos.top + 'px';
chip.style.transform = 'rotate(' + pos.rot + 'deg)';
chip.style.animationDelay = (Math.random() * 2) + 's';
stage.appendChild(chip);
chips.push({ el: chip, row: r, col: c });
});
});
}
function buildGridLines() {
gridLines.innerHTML = '';
for (let r = 0; r <= 3; r++) {
const line = document.createElement('div');
line.className = 'rd-grid-line';
line.style.left = '28px';
line.style.right = '20px';
line.style.top = (48 + r * 44) + 'px';
line.style.height = '1px';
gridLines.appendChild(line);
}
}
buildGridLines();
buildChips();
organizeBtn.addEventListener('click', () => {
organizeBtn.disabled = true;
chips.forEach((chip, i) => {
setTimeout(() => {
chip.el.style.left = colX[chip.col] + 'px';
chip.el.style.top = rowY[chip.row] + 'px';
chip.el.style.transform = 'rotate(0deg)';
}, i * 90);
});
setTimeout(() => {
stage.classList.add('is-organized');
revealLine.classList.add('is-visible');
chaosReset.classList.add('is-visible');
}, chips.length * 90 + 300);
});
chaosReset.addEventListener('click', () => {
stage.classList.remove('is-organized');
revealLine.classList.remove('is-visible');
chaosReset.classList.remove('is-visible');
organizeBtn.disabled = false;
buildChips();
});
})();
/* ---- Part B: linked tables ---- */
(function () {
const studentsTable = document.getElementById('rdStudents');
const enrollmentTable = document.getElementById('rdEnrollment');
const coursesTable = document.getElementById('rdCourses');
function clearLinks() {
[studentsTable, enrollmentTable, coursesTable].forEach(t => {
t.querySelectorAll('tbody tr').forEach(tr => tr.classList.remove('is-linked'));
});
}
studentsTable.querySelectorAll('tbody tr').forEach(row => {
row.addEventListener('click', () => {
const wasLinked = row.classList.contains('is-linked');
clearLinks();
if (wasLinked) return;
const sid = row.dataset.student;
row.classList.add('is-linked');
enrollmentTable.querySelectorAll('tbody tr').forEach(eRow => {
if (eRow.dataset.student === sid) {
eRow.classList.add('is-linked');
const cid = eRow.dataset.course;
coursesTable.querySelectorAll('tbody tr').forEach(cRow => {
if (cRow.dataset.course === cid) cRow.classList.add('is-linked');
});
}
});
});
});
})();
</script>
</body>
</html>.demo {
font-family: system-ui, sans-serif;
padding: 16px;
}
.demo h1 {
color: #2563eb;
margin: 0 0 8px;
}
.demo p {
color: #4b5563;
margin: 0;
}document.querySelector('.demo h1')?.addEventListener('click', () => {
alert('Hello from live preview!');
});