📘 Three-Schema Architecture (in DBMS)
The Three-Schema Architecture is a framework that separates the user interface, logical structure, and physical storage of data in a database. It helps achieve data abstraction, independence, and security.
🔸 Internal Schema (Physical Level)
Describes how data is actually stored on the storage media (disk, SSD, etc.).
Deals with file structures, indexes, record placement, etc.
Hidden from users.
☘Conceptual Schema (Logical Level)
Describes the structure of the entire database logically.
Focuses on tables, data types, relationships, constraints.
Independent of physical details.
Seen by database administrators and developers.
🧩 External Schema (View Level)
Describes how users see the data.
Different users may have different custom views.
Hides sensitive or irrelevant data from specific users.
🖼️ Diagram: Three-Schema Architecture
<div class="infographic-schema" id="schemaWrap">
<style>
.infographic-schema {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f6f3ee;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
--code-bg: #1e2430;
--code-ink: #d7dde8;
--tok-kw: #7aa2f7;
--tok-type: #e0af68;
--tok-str: #9ece6a;
--tok-punct: #7d8799;
background: var(--paper);
color: var(--ink);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
padding: 2.5rem 1.5rem;
border-radius: 14px;
box-sizing: border-box;
max-width: 680px;
margin: 0 auto;
}
.infographic-schema[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
--code-bg: #0e1218;
--code-ink: #d7dde8;
}
.infographic-schema * { box-sizing: border-box; }
.schema-eyebrow {
font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
color: var(--accent); font-weight: 700; margin: 0 0 0.4rem; text-align: center;
}
.schema-title { font-size: 1.4rem; font-weight: 700; margin: 0 0 2rem; text-align: center; letter-spacing: -0.01em; }
/* --- Diagram rows --- */
.lvl-row {
display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 0.75rem;
}
.lvl-label { font-size: 0.76rem; color: var(--ink-soft); font-style: italic; text-align: right; }
.lvl-content { display: flex; gap: 0.5rem; }
.lvl-content.center { justify-content: center; }
.lvl-content.spread { justify-content: space-between; }
.schema-btn {
background: var(--accent); color: #fff; border: none; border-radius: 8px;
font: inherit; font-weight: 700; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.schema-btn:hover { transform: translateY(-1px); }
.schema-btn.is-active { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 4.5px var(--accent); }
.view-btn { flex: 1 1 0; padding: 0.6rem 0.4rem; font-size: 0.78rem; text-align: center; }
.logical-btn, .physical-btn { width: 100%; max-width: 320px; padding: 0.85rem 1rem; font-size: 0.95rem; text-align: center; }
/* --- Connectors --- */
.connector-row { display: grid; grid-template-columns: 100px 1fr; gap: 0.75rem; }
.connector-row .lvl-label { visibility: hidden; }
.connector-fan svg { display: block; width: 100%; height: 26px; }
.connector-line svg { display: block; width: 100%; }
.connector-line-wrap { display: flex; justify-content: center; }
/* --- Database --- */
.db-cylinder svg { display: block; }
/* --- Detail panel --- */
.schema-panel {
margin-top: 2rem; background: var(--paper-alt); border: 1px solid var(--line);
border-radius: 12px; padding: 1.4rem 1.5rem;
}
.schema-panel.is-fading { animation: schemaFade .35s ease; }
@keyframes schemaFade { from { opacity: 0.2; } to { opacity: 1; } }
.schema-panel > *:last-child { margin-bottom: 0; }
.schema-panel-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.7rem; color: var(--accent); }
.schema-panel-list { margin: 0 0 0.9rem; padding-left: 1.1rem; font-size: 0.86rem; line-height: 1.5; }
.schema-panel-list li { margin-bottom: 0.3rem; }
.schema-example-label {
font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--ink-soft); font-weight: 700; margin: 0 0 0.3rem;
}
.schema-example-text { font-size: 0.85rem; line-height: 1.5; margin: 0 0 0.8rem; }
.schema-code {
background: var(--code-bg); color: var(--code-ink);
border-radius: 8px; padding: 0.8rem 1rem; font-size: 0.78rem; line-height: 1.5;
overflow-x: auto; margin: 0 0 0.9rem; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.tok-kw { color: var(--tok-kw); font-weight: 600; }
.tok-type { color: var(--tok-type); }
.tok-str { color: var(--tok-str); }
.tok-punct{ color: var(--tok-punct); }
.schema-output-label {
font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
color: var(--ink-soft); font-weight: 700; margin: 0 0 0.4rem;
}
.schema-output-table {
width: 100%; border-collapse: collapse; font-size: 0.82rem;
background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.schema-output-table th, .schema-output-table td {
padding: 0.45rem 0.65rem; text-align: left; border-bottom: 1px solid var(--line);
}
.schema-output-table th {
background: var(--accent-soft); color: var(--accent); font-weight: 700;
font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
}
.schema-output-table tr:last-child td { border-bottom: none; }
@media (max-width: 480px) {
.lvl-row, .connector-row { grid-template-columns: 60px 1fr; }
.lvl-label { font-size: 0.65rem; }
.view-btn { font-size: 0.68rem; padding: 0.5rem 0.25rem; }
}
@media (prefers-reduced-motion: reduce) {
.infographic-schema *, .infographic-schema *::before, .infographic-schema *::after {
animation-duration: 0.001ms !important; transition-duration: 0.001ms !important;
}
}
</style>
<p class="schema-eyebrow">Three-Schema Architecture</p>
<h2 class="schema-title">One Database, Many Views</h2>
<div class="lvl-row">
<span class="lvl-label">(View Level)</span>
<div class="lvl-content spread" id="viewRow"></div>
</div>
<div class="connector-row">
<span class="lvl-label">·</span>
<div class="connector-fan">
<svg viewBox="0 0 100 26" preserveAspectRatio="none">
<path d="M12 0 V13 M37 0 V13 M63 0 V13 M88 0 V13 M12 13 H88 M50 13 V25"
fill="none" style="stroke:var(--ink-soft)" stroke-width="1.5"/>
</svg>
</div>
</div>
<div class="lvl-row">
<span class="lvl-label">(Conceptual Level)</span>
<div class="lvl-content center" id="logicalRow"></div>
</div>
<div class="connector-row">
<span class="lvl-label">·</span>
<div class="connector-line-wrap"><span style="color:var(--ink-soft); font-size:1.2rem;">↓</span></div>
</div>
<div class="lvl-row">
<span class="lvl-label">(Internal Level)</span>
<div class="lvl-content center" id="physicalRow"></div>
</div>
<div class="connector-row">
<span class="lvl-label">·</span>
<div class="connector-line-wrap"><span style="color:var(--ink-soft); font-size:1.2rem;">↓</span></div>
</div>
<div class="lvl-row">
<span class="lvl-label"></span>
<div class="lvl-content center db-cylinder" id="dbCylinder"></div>
</div>
<div class="schema-panel" id="schemaPanel"></div>
</div>
<script>
(function () {
var wrapper = document.getElementById('schemaWrap');
// Dark mode detection — body attribute wins, then cookie, then light default
var bodyAttr = document.body.getAttribute('data-darkmode');
var dark;
if (bodyAttr === 'true') {
dark = true;
} else if (bodyAttr === 'false') {
dark = false;
} else {
var match = document.cookie.match(/(?:^|;\s*)darkMode=([^;]+)/);
dark = match ? match[1] === 'true' : false;
}
if (dark) wrapper.setAttribute('data-theme', 'dark');
// Shared sample data behind every view
var studentRows = [
{ RollNo: '101', Name: 'Aditi', Class: '10-A', Marks: '88' },
{ RollNo: '102', Name: 'Rohan', Class: '10-A', Marks: '76' }
];
function outputFor(columns) {
return {
columns: columns,
rows: studentRows.map(function (r) { return columns.map(function (c) { return r[c]; }); })
};
}
var views = [
{ label: 'View 1', title: 'View 1 — Teacher View', cols: ['Name', 'Marks'],
detail: 'A teacher only needs to see names alongside marks — nothing else.' },
{ label: 'View 2', title: 'View 2 — Admin View', cols: ['RollNo', 'Name', 'Class', 'Marks'],
detail: 'An administrator gets the full record for record-keeping and audits.' },
{ label: 'View 3', title: 'View 3 — Parent View', cols: ['Name', 'Class'],
detail: 'A parent portal shows the student\u2019s name and class, not marks or IDs.' },
{ label: 'View 4', title: 'View 4 — Office View', cols: ['RollNo', 'Class'],
detail: 'The front office only needs roll numbers matched to a class for logistics.' }
];
var logicalInfo = {
title: 'Logical Level (Conceptual)',
bullets: [
'Describes what data is stored and the relationships between it.',
'Defines tables, columns, data types, and constraints.',
'One conceptual schema feeds every view above it.'
],
example: 'The single Student table that all four views above are built from.',
code: 'CREATE TABLE Student (\n RollNo INT,\n Name VARCHAR(50),\n Class VARCHAR(10),\n Marks INT\n);',
output: outputFor(['RollNo', 'Name', 'Class', 'Marks'])
};
var physicalInfo = {
title: 'Physical Level (Internal)',
bullets: [
'Describes how data is actually stored in memory or on disk.',
'Deals with storage blocks, indexing, and compression.',
'Completely hidden from end users and view definitions above.'
],
example: 'How the Student table is stored as a file, indexed by roll number, on disk.',
code: null,
output: null
};
var viewRow = document.getElementById('viewRow');
var logicalRow = document.getElementById('logicalRow');
var physicalRow = document.getElementById('physicalRow');
var dbCylinder = document.getElementById('dbCylinder');
var panel = document.getElementById('schemaPanel');
var allButtons = [];
function clearActive() {
allButtons.forEach(function (b) { b.classList.remove('is-active'); });
}
function highlightSQL(code) {
var escaped = code.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
var keywords = /\b(CREATE|VIEW|TABLE|AS|SELECT|FROM|INSERT|INTO|VALUES)\b/g;
var types = /\b(INT|VARCHAR)\b/g;
var strings = /('[^']*')/g;
var punct = /([(),;])/g;
return escaped
.replace(keywords, '<span class="tok-kw">$1</span>')
.replace(types, '<span class="tok-type">$1</span>')
.replace(strings, '<span class="tok-str">$1</span>')
.replace(punct, '<span class="tok-punct">$1</span>');
}
function buildOutputTable(output) {
var html = '<p class="schema-output-label">Output</p><table class="schema-output-table"><thead><tr>';
output.columns.forEach(function (c) { html += '<th>' + c + '</th>'; });
html += '</tr></thead><tbody>';
output.rows.forEach(function (row) {
html += '<tr>';
row.forEach(function (cell) { html += '<td>' + cell + '</td>'; });
html += '</tr>';
});
html += '</tbody></table>';
return html;
}
function renderViewPanel(v) {
var out = outputFor(v.cols);
var html = '<h3 class="schema-panel-title">' + v.title + '</h3>';
html += '<p class="schema-example-label">What it shows</p>';
html += '<p class="schema-example-text">' + v.detail + '</p>';
html += buildOutputTable(out);
panel.innerHTML = html;
replay();
}
function renderLevelPanel(info) {
var html = '<h3 class="schema-panel-title">' + info.title + '</h3>';
html += '<ul class="schema-panel-list">';
info.bullets.forEach(function (b) { html += '<li>' + b + '</li>'; });
html += '</ul>';
html += '<p class="schema-example-label">Example</p>';
html += '<p class="schema-example-text">' + info.example + '</p>';
if (info.code) {
html += '<pre class="schema-code">' + highlightSQL(info.code) + '</pre>';
}
if (info.output) {
html += buildOutputTable(info.output);
}
panel.innerHTML = html;
replay();
}
function replay() {
panel.classList.remove('is-fading');
void panel.offsetWidth;
panel.classList.add('is-fading');
}
views.forEach(function (v, i) {
var btn = document.createElement('button');
btn.type = 'button';
btn.className = 'schema-btn view-btn' + (i === 0 ? ' is-active' : '');
btn.textContent = v.label;
btn.addEventListener('click', function () {
clearActive();
btn.classList.add('is-active');
renderViewPanel(v);
});
viewRow.appendChild(btn);
allButtons.push(btn);
});
var logicalBtn = document.createElement('button');
logicalBtn.type = 'button';
logicalBtn.className = 'schema-btn logical-btn';
logicalBtn.textContent = 'Logical Level';
logicalBtn.addEventListener('click', function () {
clearActive();
logicalBtn.classList.add('is-active');
renderLevelPanel(logicalInfo);
});
logicalRow.appendChild(logicalBtn);
allButtons.push(logicalBtn);
var physicalBtn = document.createElement('button');
physicalBtn.type = 'button';
physicalBtn.className = 'schema-btn physical-btn';
physicalBtn.textContent = 'Physical Level';
physicalBtn.addEventListener('click', function () {
clearActive();
physicalBtn.classList.add('is-active');
renderLevelPanel(physicalInfo);
});
physicalRow.appendChild(physicalBtn);
allButtons.push(physicalBtn);
dbCylinder.innerHTML =
'<svg width="70" height="60" viewBox="0 0 70 60">' +
'<path d="M3 13 C3 7 16 3 35 3 C54 3 67 7 67 13 V47 C67 53 54 57 35 57 C16 57 3 53 3 47 Z" ' +
'fill="none" style="stroke:var(--ink-soft)" stroke-width="2"/>' +
'<path d="M3 13 C3 19 16 23 35 23 C54 23 67 19 67 13" fill="none" style="stroke:var(--ink-soft)" stroke-width="2"/>' +
'</svg>' +
'<div style="text-align:center; font-size:0.75rem; color:var(--ink-soft); margin-top:0.3rem;">Database</div>';
renderViewPanel(views[0]);
})();
</script>.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!');
});🎯View of Data in DBMS
The view of data refers to how data is seen and accessed by different types of users:
User Type | Schema Used | Access Level |
|---|---|---|
End User | External Schema | Limited/custom view |
Application Programmer | Conceptual Schema | Full logical design |
Database Administrator | Internal Schema | Full physical structure |
🧠 Abstraction Provided by DBMS
Abstraction helps hide complexity and isolate layers:
Abstraction Level | What It Hides | Exposes |
|---|---|---|
View Level | Logical & physical schema | Relevant user-specific data |
Logical Level | Physical storage | Entire logical structure |
Physical Level | Nothing (lowest layer) | File formats, storage blocks, indexes |
✅ Key Benefits of This Architecture
🔐 Security – Users can access only what they’re allowed to.
🔁 Data Independence – Changes at one level don’t affect others.
📐 Simplicity – Users and developers work on only relevant parts.