MODULE 01
DATABASE SYSTEM CONCEPTS — INTRO, CHARACTERISTICS, MODELS & LANGUAGES
01
Core Concepts

Data, Information, Database & DBMS

The Chain: Raw Data → (processing) → Information → (stored together) → Database → (managed by) → DBMS

Data vs Information

Raw DataProcessed Information
9884567890Mobile number of student Rajesh
72.5Marks scored by Priya in Maths (out of 100)
2024-03-15Date of DBMS lecture
500001PIN code: Hyderabad, Telangana
Exam tip: Data = raw facts with no context. Information = data + context + meaning. Information enables decision-making.

Database — Key Definitions

Database = logically coherent, organized collection of related data to meet an organization's information needs.
Formal (Coronel): "A DATABASE is a shared, integrated computer structure that stores end-user data (raw facts) and metadata (data about the structure of the data)."
DomainWhat's Stored
UniversityStudents, courses, faculty, enrollment, marks, fees
HospitalPatients, doctors, appointments, diagnoses, prescriptions
BankAccounts, transactions, loans, customers, branches
E-CommerceProducts, orders, customers, inventory, payments
RailwayTrains, seats, passengers, bookings, schedules

DBMS — What It Does

DBMS = collection of programs that enables users to create, maintain, and control access to a database. Acts as intermediary between DB and users/apps.
CapabilityWhat It Means
DefineSpecify data types, structures, constraints (DDL)
ConstructStore data on storage medium
ManipulateQuery, update, generate reports (DML)
ShareAllow multiple users concurrent access
Protect & MaintainSecurity, backup, recovery
MySQL is the DBMS; the student records stored using MySQL form the Database. They are NOT the same thing!

Database System Environment — 4 Components

💻 HARDWARE
Servers, Storage, Network
🛠 SOFTWARE
DBMS, OS, Apps
📦 DATA
Content + Metadata
👥 USERS
End Users, Programmers, DBA
02
File vs DB

File-Based Problems & 10 DB Characteristics

8 Problems of File-Based Systems

#ProblemConsequence
1Data RedundancySame data stored in multiple files; wastes storage
2Data InconsistencyDifferent files have contradictory values for same data
3Difficult Data AccessNew program needed for every new query; no standard SQL
4Data IsolationData in different formats across files; integration is hard
5Integrity ProblemsConstraints buried in programs; adding new rules is costly
6Atomicity ProblemsSystem crash leaves partial updates; no rollback
7Concurrent AccessTwo users book last seat — both succeed (race condition)
8Security LimitationsOnly coarse-grained file-level access control

10 Characteristics of the Database Approach

#CharacteristicCore Benefit
1Self-Describing NatureDB stores its own structure via System Catalog / Data Dictionary (metadata)
2Program-Data IndependenceStorage structure changes don't break application programs
3Multiple Views of DataEach user/group sees only the data they need (virtual tables)
4Multiuser Transaction Processing (ACID)Safe concurrent access; all-or-nothing operations
5Control of Data RedundancyEach item stored once; foreign keys establish relationships
6Authorization and SecurityFine-grained access at table/column/row/operation level
7Persistent Storage of ObjectsComplex objects (GIS, multimedia) survive program execution
8Efficient Query ProcessingIndexes (B+ Trees), buffer pools, query optimizer
9Backup and RecoveryWAL logs + checkpoints enable full DB recovery
10Integrity ConstraintsCentrally defined rules enforced for all users automatically

ACID Properties (Characteristic #4) — Deep Dive

PropertyMeaningBank Transfer Example
AtomicityAll-or-nothing executionDebit + Credit both happen, or neither does
ConsistencyDB moves from one valid state to anotherTotal money before = total money after
IsolationConcurrent transactions don't see each other's intermediate statesNo one sees A debited but B not yet credited
DurabilityCommitted changes survive crashesTransfer saved even if power fails right after commit

Integrity Constraint Types (Characteristic #10)

ConstraintDescriptionExample
DomainValues must be in defined domainAge: INTEGER, Marks: 0–100
Entity IntegrityPrimary Key ≠ NULLStudent_ID cannot be null
Referential IntegrityFK must match existing PK or be NULLDept_ID must exist in DEPARTMENT
KeyCandidate key uniqueness enforcedNo two students with same roll number
SemanticBusiness rules via CHECK/triggersSalary increase ≤ 30% per update
CREATE TABLE STUDENT (
  Student_ID  INT         PRIMARY KEY,
  Name        VARCHAR(50) NOT NULL,
  Age         INT         CHECK (Age BETWEEN 15 AND 35),
  Dept_ID     INT         REFERENCES DEPARTMENT(Dept_ID)
);

Backup & Recovery Mechanisms (Characteristic #9)

Failure TypeRecovery Mechanism
Transaction FailureTransaction Rollback (undo log)
System CrashCrash Recovery (redo committed, undo uncommitted)
Media FailureMedia Recovery (restore from backup + logs)
Human ErrorPoint-in-Time Recovery (restore to timestamp)
WAL (Write-Ahead Log) = log the change BEFORE writing to DB. Checkpoints = periodic snapshots to reduce recovery time.

File System vs Database — Master Comparison

AspectFile SystemDatabase (DBMS)
Data StorageSeparate, independent filesCentralized, integrated
Data RedundancyHigh — duplicated everywhereControlled — stored once
ConsistencyLow — files can contradictHigh — DBMS enforces
Data AccessCustom program per queryStandard SQL
SecurityFile-level onlyTable/column/row/op level
Backup & RecoveryManual — programmer's jobAutomatic — DBMS manages
ConcurrencyRace conditions possibleFull ACID control
Data IndependenceNone — tied to programsPhysical & logical independence
CostLow initial costHigh initial, lower long-term

Multiple Views Example (Characteristic #3)

User RoleView Access
StudentOwn marks, attendance, fee status only
FacultyMarks of students in their course (no financial data)
Accounts ClerkFee records, dues, scholarships (no academic records)
RegistrarAll student data, enrollment, degrees
Views provide security, simplicity, customization, and data abstraction — all from one underlying database.
03
Actors

Actors on the Scene & Workers Behind the Scene

Actors on the Scene (Direct Users — interact with DB)

Database Administrator (DBA) — Manages the ENTIRE database environment. Most critical human resource.
DBA Responsibilities
Install & configure DBMSDefine schema (tables, columns, constraints)
Grant/revoke access privilegesMonitor performance & tune queries
Manage backup & recoveryApply security patches & upgrades
Enforce data standardsHandle concurrency control & deadlocks
Database Designers — Design structure BEFORE data is loaded; understand user requirements.
  • Identify data to be stored and relationships
  • Create ER diagrams → convert to relational tables
  • Define primary keys, foreign keys, constraints
  • Apply normalization rules; create indexes

End Users Classification

TypeDescriptionExamples
Naive (Casual)Use pre-written apps, unaware of DB internalsATM users, e-commerce shoppers, hospital registration
SophisticatedDirect SQL interaction; understand DB conceptsBusiness analysts, scientists, engineers
StandaloneMaintain personal databases using desktop toolsPersonal library in MS Access
RoleResponsibility
System AnalystsDetermine user requirements; design specifications
Application ProgrammersImplement specs; write SQL-embedded programs (Java, Python, PHP)

Workers Behind the Scene (Invisible — build/maintain the DBMS itself)

RoleFunction
DBMS System DesignersDesign/build DBMS components: query processor, storage engine, transaction manager
Tool DevelopersCreate design tools, GUI tools (SQL Workbench, pgAdmin, TOAD), performance monitors
Operators & MaintenanceRun/maintain hardware/software environment; backups; monitoring
Key distinction: Actors on the scene use the DB. Workers behind the scene build/maintain the DBMS software itself.
04
Advantages

13 Advantages of the DBMS Approach

#AdvantageHow
1Controlling Data RedundancyEach item stored once; FK establishes relationships
2Restricting Unauthorized AccessAuthentication, roles, audit logging
3Persistent StorageData persists across program executions and restarts
4Efficient Query ProcessingIndexes, buffer pools, query optimizer
5Backup and RecoveryAutomatic management with WAL, checkpoints
6Multiple User InterfacesSQL for experts, GUI for naive users, APIs for programmers
7Complex Relationships1:1, 1:N, M:N via keys and joins
8Integrity ConstraintsCentrally defined and enforced for all users
9Inferencing and RulesTriggers and stored procedures for automatic actions
10Reduced Development TimeDevelopers focus on business logic, not data management
11FlexibilitySchema modifications with minimal program impact
12Current InformationAll users see most current data after commit
13Economies of ScaleCentralized data reduces overall cost

When NOT to Use a DBMS

SituationReason to Avoid DBMS
High initial costSoftware, hardware, training are expensive
High overheadDBMS consumes significant CPU, memory, disk
Simple applicationsSingle-user, single-purpose with small fixed dataset
Real-time systemsStrict timing constraints may find DBMS overhead unacceptable
Embedded systemsVery limited resources may not support full DBMS
For exam: DBMS always has overhead — justifiable only when data is large, shared, or complex. A simple to-do list app doesn't need Oracle.
05
Data Models

Data Models, Schemas & Instances

Data Model = a collection of concepts used to describe database structure — data types, relationships, and constraints. The "blueprint" for a database.

3 Categories of Data Models

HIGH-LEVEL (Conceptual) • ER Model • Object-Oriented Close to user perception REPRESENTATIONAL (Implementation) • Relational (SQL) • Network • Hierarchical Between conceptual and physical LOW-LEVEL (Physical) • Record formats • Storage allocation • Access paths Managed internally by DBMS
LevelAlso CalledExamplesUser
High-LevelConceptual ModelER Model, Object-Oriented ModelDatabase Designer
RepresentationalImplementation / Logical ModelRelational, Network, HierarchicalProgrammer / DBA
Low-LevelPhysical ModelRecord formats, Indexes, B-TreesDBMS (internal)

Schema vs Instance

Schema (Structure)
  • Description of database — types & constraints
  • Defined at design time
  • Changes infrequently (like a class definition)
  • Also called intension
STUDENT(Student_ID: INT, Name: VARCHAR(50), Age: INT, Dept_ID: INT)
Instance (State / Snapshot)
  • Actual data at a particular moment
  • Changes with every INSERT/UPDATE/DELETE
  • Also called extension
  • Multiple valid instances for one schema
(101, 'Arun', 20, 'CS')
(102, 'Priya', 21, 'IT')
📌 Analogy: Schema = blueprint/class. Instance = actual building/object. You have one schema but many instances over time.

Major Data Models — Visual + Simple Properties

Note: In exams, "rational model" usually means Relational model. Here, Float model is treated as a distinct 2D-array numeric model.
ER Model
[STUDENT] --- ENROLLS --- [COURSE]
   | PK: Student_ID            | PK: Course_ID
   | Name, Dept                | Title, Credits
  • Conceptual model for database design.
  • Uses entities, attributes, relationships.
  • Easy for users to understand before table creation.
Relational Model
STUDENT(Student_ID, Name, Dept_ID)
COURSE(Course_ID, Title)
ENROLL(Student_ID, Course_ID)

Join by keys: STUDENT.Student_ID = ENROLL.Student_ID
  • Data stored as tables (relations).
  • Primary keys and foreign keys define links.
  • Manipulated using SQL; most widely used model.
Hierarchical Model
COMPANY
  |
  +-- DEPARTMENT
        |
        +-- EMPLOYEE
  • Tree structure with parent-child records.
  • Supports 1:N naturally.
  • Fast for fixed paths, less flexible for complex queries.
Network Model
[SUPPLIER] ---- supplies ---- [PART]
     \                          /
      \---- works_with --------/
  • Graph-like structure (records + set links).
  • Supports M:N relationships directly.
  • More flexible than hierarchical, but complex to manage.
Object-Oriented Model
class Student {
  id, name
  enroll(course)
}

object s1 : Student
  • Stores data as objects with state and behavior.
  • Supports classes, inheritance, encapsulation.
  • Good for complex data like CAD, multimedia, GIS.
Float Model
2D Array (no duplicates)

[ 1.2500, 2.5000, 3.7500 ]
[ 4.1250, 5.2500, 6.5000 ]
[ 7.8750, 8.0000, 9.6250 ]
  • Structure: Organized as a two-dimensional array.
  • No Duplicates: Duplicate elements are not allowed.
  • Precision: Useful for high-precision decimal numeric values.
  • Use Case: Best for small, specialized numeric datasets.
  • Limitations: Inefficient for large-scale storage and lacks complex relational mapping.
06
3-Schema

Three-Schema Architecture & Data Independence

Purpose (ANSI/SPARC Architecture): Achieve data independence — separate user applications from physical database. Proposed to standardize DBMS structure.

Three-Schema Architecture — Visual

EXTERNAL LEVEL (View Schema) View 1 View 2 View 3 Multiple user views — customized per group External/Conceptual Mapping CONCEPTUAL LEVEL (Logical Schema) Complete logical structure of entire DB Tables, relationships, constraints — no physical details Conceptual/Internal Mapping INTERNAL LEVEL (Physical Schema) Physical storage structure Files, indexes, storage allocation, B-Trees PHYSICAL DATABASE
LevelAlso CalledWhat It DescribesWho Uses It
ExternalView Level / User SchemaWhat individual users/groups see — customized subsetsEnd Users, App Programs
ConceptualLogical LevelComplete logical structure — all tables, relationships, constraintsDBA, Designers
InternalPhysical LevelHow data is physically stored — files, indexes, storage structuresDBMS (internal)

Data Independence — The Main Goal

Data Independence = ability to change schema at one level WITHOUT changing schema at the next higher level.
Physical Data Independence

What changes: Internal schema (storage, indexes, file organization)

What stays same: Conceptual schema + external views

Examples: Add/remove indexes, move to SSD, change file organization

Logical Data Independence

What changes: Conceptual schema (add tables/columns)

What stays same: External views + application programs

Examples: Add new table, add columns, split tables

⚠ Harder to achieve than physical independence

07
Languages

Database Languages & Interfaces

SQL Sub-Languages Overview

LanguageFull NamePurposeCommands
DDLData Definition LanguageDefine/modify DB structure (schema)CREATE, ALTER, DROP, TRUNCATE
DMLData Manipulation LanguageRetrieve, insert, update, delete dataSELECT, INSERT, UPDATE, DELETE
DCLData Control LanguageControl access/permissionsGRANT, REVOKE
TCLTransaction Control LanguageManage transactionsCOMMIT, ROLLBACK, SAVEPOINT
VDLView Definition LanguageDefine user views (external schema)CREATE VIEW

DDL Examples

-- Create table with constraints
CREATE TABLE STUDENT (
  Student_ID INT         PRIMARY KEY,
  Name       VARCHAR(50) NOT NULL,
  Age        INT
);
-- Add a column
ALTER TABLE STUDENT ADD COLUMN Email VARCHAR(100);
-- Remove table (irreversible!)
DROP TABLE STUDENT;

DML Examples + Procedural vs Non-Procedural

TypeUser specifiesExample
ProceduralWHAT + HOW to get itNetwork/hierarchical languages
Non-Procedural (Declarative)WHAT only — DBMS decides HOWSQL (most common)
SELECT Name, Age FROM STUDENT WHERE Dept_ID = 'CS';
INSERT INTO STUDENT VALUES (103, 'Kavya', 20, 'EC');
UPDATE STUDENT SET Age = 21 WHERE Student_ID = 101;
DELETE FROM STUDENT WHERE Student_ID = 102;

DCL & TCL Examples

-- DCL: Permissions
GRANT SELECT, INSERT ON STUDENT TO faculty_user;
REVOKE DELETE ON MARKS FROM exam_staff;

-- TCL: Transactions
COMMIT;                        -- permanently save changes
ROLLBACK;                      -- undo since last commit
SAVEPOINT before_update;      -- partial rollback point

-- VDL: Views
CREATE VIEW Student_Marks AS
  SELECT s.Name, m.Subject, m.Marks
  FROM STUDENT s JOIN MARKS m ON s.Student_ID = m.Student_ID;

Database Interfaces

Interface TypeDescriptionUse Case
Menu-BasedLists of options; no SQL knowledge neededWeb clients, e-commerce portals
Forms-BasedScreen fields for data entryBanking forms, employee records
GUIVisual tools, drag-and-dropMS Access, pgAdmin, SQL Workbench
Natural LanguageEnglish queries converted to SQL"Show students with marks > 80"
Keyword-BasedSearch engine style queriesDocument databases
Speech I/OVoice input and synthesized outputTelephone inquiry systems
ParametricPredefined transactions via function keysBank tellers, booking agents
DBA InterfaceAdmin tools: schema, security, performanceOracle Enterprise Manager

DBMS Internal Components

ComponentRole
Query ProcessorParses and compiles SQL into execution plans
Query OptimizerSelects lowest-cost execution strategy
Transaction ManagerEnforces ACID properties
Concurrency Control ManagerImplements locking and timestamp protocols
Recovery ManagerManages WAL, checkpoints, crash recovery
Buffer ManagerManages memory buffer pool (caching)
Storage ManagerManages physical storage and indexes
Data Dictionary/CatalogStores all metadata (the self-describing part)
08
Data Types

Structured, Semi-Structured & Unstructured Data

Visual Overview

STRUCTURED Fixed schema Rows & Columns Queried with SQL MySQL, Oracle, PostgreSQL SEMI-STRUCTURED { "name": "Priya", "age": 21, "courses": [...] } Flexible/self-describing XML / JSON MongoDB, CouchDB UNSTRUCTURED 📄🖼🎵 No schema at all ~80–90% of all data Needs AI/ML to process Text, images, audio, video, social media

Master Comparison Table

AspectStructuredSemi-StructuredUnstructured
SchemaFixed, predefinedFlexible, self-describingNone
FormatTables (rows/cols)XML, JSON, HTMLText, images, video, audio
Query LanguageSQLXQuery, MongoDB QueryFull-text search, AI/ML
DBMSMySQL, Oracle, PostgreSQLMongoDB, CouchDB, eXist-dbAmazon S3, Elasticsearch
ConsistencyHighMediumLow
ScalabilityModerateHighVery High
% of World Data~20%~<5%~80–90%

Polyglot Persistence — Using All Three Together

Polyglot Persistence = using different database types within a single application architecture for different data types.
Data TypeStorageUse Case (Hospital System)
StructuredRDBMS (MySQL)Patient records, billing, appointments
Semi-StructuredMongoDBJSON messages from medical devices
UnstructuredObject Storage (S3)MRI scan images, X-rays
?
Flashcards

Tap to Flip

Click any card to reveal the answer

Quick Ref

Master Cheatsheet

Everything in One Table

TopicKey Fact
Data vs InformationData = raw facts; Information = data + context + meaning
Database (Coronel def)Shared, integrated structure storing end-user data + metadata
DBMS vs DatabaseMySQL = DBMS. Student records in MySQL = Database.
DB Environment componentsHardware, Software, Data, Users (4 things)
File system problems count8 problems (redundancy, inconsistency, difficult access, isolation, integrity, atomicity, concurrency, security)
DB Characteristics count10 characteristics
Characteristic #1Self-Describing — DB stores its own metadata in System Catalog
Characteristic #2Program-Data Independence — structure changes don't break programs
Characteristic #4Multiuser Transaction Processing — ACID properties
ACID stands forAtomicity, Consistency, Isolation, Durability
AtomicityAll or nothing — no partial transactions
IsolationConcurrent txns don't see each other's intermediate states
WALWrite-Ahead Log — log BEFORE writing to DB
SchemaStructure/blueprint — changes infrequently (intension)
InstanceActual data at a moment — changes constantly (extension)
3-Schema levelsExternal (View) → Conceptual (Logical) → Internal (Physical)
Physical Data IndependenceChange internal schema; conceptual schema unchanged
Logical Data IndependenceChange conceptual schema; external views unchanged (harder)
DBA roleManages entire DB environment: schema, security, backup, performance
Naive end usersUse pre-written apps; unaware of DB internals (ATM users)
Workers behind the sceneBuild/maintain DBMS itself (not the data)
Advantages count13 advantages of DBMS approach
High-Level data modelER Model, Object-Oriented — close to user perception
Representational data modelRelational, Network, Hierarchical
DDL commandsCREATE, ALTER, DROP, TRUNCATE
DML commandsSELECT, INSERT, UPDATE, DELETE
DCL commandsGRANT, REVOKE
TCL commandsCOMMIT, ROLLBACK, SAVEPOINT
SQL typeNon-procedural/Declarative — user says WHAT, not HOW
Structured dataFixed schema, SQL, RDBMS (MySQL, Oracle)
Semi-structured dataFlexible schema, XML/JSON, MongoDB/CouchDB
Unstructured dataNo schema, ~80–90% of all data, needs AI/ML
Polyglot persistenceUsing different DB types for different data in same app
Query optimizer doesSelects lowest-cost execution plan for SQL queries
Data DictionaryStores metadata — enables self-describing characteristic
Index performanceB+ Tree: O(log n) lookups vs O(n) full scan