A DBMS stores shared data once, describes it with schemas and lets many users query it safely. The three-schema architecture gives data independence; data models and the DDL/DML/DCL/TCL languages frame everything else in this module.
Medium 40 minSyllabus: “Foundation for the DBMS module”
Mark as
The idea in one minute
A DBMS works like a well-run library. Books (data) are kept once, a catalogue (the data dictionary) describes every book, librarians (the DBA) decide who may borrow what, and each reader sees only the shelves meant for them (views). The basement stacks can be rearranged without reprinting the catalogue — that is data independence — and two readers can never walk off with the same last copy at once.
Key points — the night-before list
File-system drawbacks: redundancy, inconsistency, difficult access, data isolation, integrity, atomicity, concurrent-access anomalies and security problems.
ANSI/SPARC (1975) three levels: external (many views), conceptual (one logical schema), internal (one storage schema), joined by two mappings.
Physical data independence: change the internal schema without touching the conceptual one (easier). Logical: change the conceptual schema without touching views or programs (harder).
Schema = design (intension, changes rarely); instance/state = data at a moment (extension, changes constantly). Metadata lives in the data dictionary (system catalog).
A database is a collection of related data — facts that can be recorded and that have meaning, such as an allottee's name, the house allotted to them and each instalment they paid. A database management system (DBMS) is the software that defines, stores, retrieves and protects that data for many users and programs at the same time. Oracle, MySQL, PostgreSQL, SQL Server and SQLite are DBMSs; the data plus the DBMS software together form a database system.
Before DBMSs, organisations used a file-processing system: every department kept its own files and wrote its own programs for them. Picture a housing board whose allotment, accounts and maintenance sections each keep a separate file of allottees. It works on day one, but every new file and program makes the problems below worse.
Drawback
What goes wrong (housing-board example)
How a DBMS helps
Redundancy
The allottee's address is stored in all three files
One shared copy; duplication only where it is planned
Inconsistency
Address updated in accounts but not in maintenance — two versions of the truth
A single copy, so one update fixes it everywhere
Difficulty in accessing data
'Allottees in Kochi with two pending instalments' needs a brand-new program
Ad-hoc queries in SQL, no new program needed
Data isolation
Data scattered over many files in different formats
One integrated database described by one schema
Integrity problems
Rules such as 'instalment amount > 0' are buried inside many programs
Constraints declared once and enforced by the DBMS
Atomicity problems
Power fails after a payment is debited but before it is credited
Transactions are all-or-nothing; the recovery manager undoes partial work
Concurrent-access anomalies
Two clerks update the same balance at once and one update is lost
Concurrency control (locks, timestamps) orders conflicting access
Security problems
Hard to let a clerk see addresses but not payments
Views plus GRANT/REVOKE give fine-grained authorisation
The eight classic drawbacks of file-processing systems
Advantages of the database approach: controlled redundancy, data sharing, integrity enforcement, restricted unauthorised access, backup and recovery, concurrency control, multiple interfaces (SQL, forms, APIs), data independence, faster application development and enforcement of standards.
Disadvantages: cost of software, hardware and trained staff; complexity; overhead that a tiny single-user application does not need; and a critical single point of failure that must be secured and backed up.
02The three-schema (ANSI/SPARC) architecture
In 1975 the ANSI/X3/SPARC study group proposed describing a database at three levels of abstraction, so that end users, designers and storage engineers can each work at the level that matters to them. Each level is described by its own schema.
The three levels, top to bottom
External level (view level)
Many external schemas, one per user group. A payroll clerk's view shows emp_id, ename and salary; a receptionist's view shows ename and dname but hides salary. Each view hides the rest of the database.
Conceptual level (logical level)
Exactly one conceptual schema for the whole database: all entities, attributes, relationships, data types and constraints — for example emp(emp_id, ename, job, salary, hire_date, dept_id, manager_id) with dept_id referencing dept. Storage details are hidden here.
Internal level (physical level)
Exactly one internal schema describing storage: file organisation (heap, sorted or hashed), record layout, indexes such as a B+ tree on emp_id, compression and placement of records on disk pages.
TextThree levels and two mappings
Payroll clerk Receptionist Manager
| | |
External schema 1 External schema 2 External schema 3 <- many views
\ | /
external/conceptual mappings (one per view)
|
Conceptual schema <- one logical design
|
conceptual/internal mapping
|
Internal schema <- one storage design
|
Stored database on disk
Between the levels sit two mappings. The external/conceptual mapping says how each view is computed from the conceptual schema; the conceptual/internal mapping says how each logical record is stored. A query on a view is translated down through both mappings to the stored data — that translation is the run-time price of the architecture.
PSC favourite
PSC asks: the number of levels (three), which level has many schemas (external), which level describes indexes and file organisation (internal), and which mapping gives which independence (external/conceptual → logical, conceptual/internal → physical).
03Data independence: physical and logical
Data independence is the ability to change the schema at one level without having to change the schema at the next higher level. It is the main payoff of the three-schema architecture: programs keep working while the database evolves underneath them; only a mapping is rewritten.
Physical data independence
Change the internal schema without changing the conceptual schema
Examples: add or drop an index, switch from a heap file to a hashed file, move data files to SSD, change the block size, compress a table
Only the conceptual/internal mapping is updated
Easier to achieve — every modern RDBMS provides it
Codd's Rule 8
Logical data independence
Change the conceptual schema without changing external schemas or application programs
Examples: add a column, add a new table, split emp into two tables and define a view that rebuilds the old emp
Only the external/conceptual mappings are updated
Harder — programs depend on the names, types and structure of the logical data
Codd's Rule 9
Logical independence has limits. Adding a column or restructuring tables can be hidden behind a view that preserves the old shape, but dropping an attribute a program actually uses can never be hidden. That is why logical independence is called harder to achieve.
Watch out
Don't swap them: physical independence shields the conceptual schema from storage changes; logical independence shields views and programs from conceptual changes. The trick option in MCQs usually claims physical independence is the harder one.
04Schema, instance and the data dictionary
The schema is the description of the database — its tables, attributes, data types and constraints — fixed at design time and changed rarely. The instance (or database state) is the data actually stored at one moment; it changes with every insert, update and delete. Textbooks call the schema the intension and the instance the extension of the database.
A programming analogy helps: the declaration int marks[60]; is like a schema, and the sixty numbers currently held in the array are an instance. In this module's sample database, emp(emp_id, ename, job, salary, hire_date, dept_id, manager_id) is part of the schema, and the ten employee rows from Anil to Jose form today's instance.
The DBMS keeps schemas and other metadata — data about data: table definitions, constraints, users, privileges, statistics — in a data dictionary or system catalog, itself stored as tables. SQLite exposes it as sqlite_schema, Oracle through views such as USER_TABLES, and MySQL and PostgreSQL through INFORMATION_SCHEMA.
DBMS component
Job
DDL interpreter
Interprets DDL statements and records the definitions in the data dictionary
DML compiler and query optimizer
Translates a query into low-level evaluation plans and picks the cheapest one
Query evaluation engine
Executes the low-level instructions of the chosen plan
Authorization and integrity manager
Checks user privileges and integrity constraints
Transaction manager
Keeps the database consistent despite failures and runs concurrent transactions without conflicts
File manager and buffer manager
Allocate disk space and data structures; move pages between disk and main memory
Inside a DBMS: the first three form the query processor, the last three the storage manager
Note
A PSC question listed 'manages allocation of space on disk and the data structures used to represent information' as the odd one out among query-processor functions — that job belongs to the storage manager (file manager).
05Data models
A data model is a set of concepts for describing the structure of a database (data types and relationships), the operations allowed on it and the constraints it must obey. Models are grouped as conceptual (high-level, close to how users think — the E-R model), representational or logical (relational, network, hierarchical) and physical (how data is laid out in storage).
Model
Structure
Landmark / example
Notes
Hierarchical
Tree of records; every child has exactly one parent (1:N)
IBM IMS (1966–68, built for the Apollo programme)
M:N needs duplicated or virtual records; access by navigating paths
Tables (relations) of rows (tuples) and columns (attributes)
E. F. Codd, 1970; System R, DB2, Oracle, MySQL, PostgreSQL
Declarative queries in SQL; dominant since the 1980s
Entity–relationship
Entities, attributes and relationships drawn as diagrams
Peter Chen, 1976
A conceptual design tool that is later mapped to tables
Object-oriented
Objects with identity (OID), classes, inheritance, methods
ODMG standard and OQL; db4o, ObjectDB
Suits complex objects such as CAD and multimedia
Object-relational
Relational tables plus user-defined types and inheritance
SQL:1999; PostgreSQL, Oracle
Extends SQL instead of replacing it
NoSQL
Key-value, document, wide-column or graph stores
Redis, MongoDB, Cassandra and HBase, Neo4j
Built to scale out; often eventual consistency instead of ACID
Data models at a glance
Relational terms map onto everyday words: a relation is a table, a tuple is a row (record), an attribute is a column (field) and a domain is the set of values an attribute may take. The degree (arity) of a relation is its number of attributes; its cardinality is its number of tuples. The sample emp table has degree 7 and cardinality 10.
NoSQL systems trade some of SQL's guarantees for horizontal scale. Brewer's CAP theorem says that a distributed store hit by a network partition must choose between consistency and availability; many NoSQL stores choose availability and offer BASE semantics (basically available, soft state, eventually consistent) instead of ACID.
PSC favourite
Frequently asked: tuple = record/row; relation = table; degree = number of columns; cardinality = number of rows; hierarchical and network models are older than the relational model; Codd proposed the relational model in 1970 and Chen the E-R model in 1976.
06Database languages: DDL, DML, DCL and TCL
SQL bundles several sub-languages. DDL (data definition language) defines and changes schema objects; DML (data manipulation language) reads and changes rows; DCL (data control language) grants and removes privileges; TCL (transaction control language) ends or partially undoes transactions. Some books list SELECT separately as DQL (data query language).
Sub-language
Commands
Acts on
DDL
CREATE, ALTER, DROP, TRUNCATE, RENAME, COMMENT
Schema objects — tables, views, indexes, users
DML
SELECT, INSERT, UPDATE, DELETE, MERGE
Rows, i.e. the instance
DCL
GRANT, REVOKE
Privileges
TCL
COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION
Transactions
A DML is procedural when the user says how to get the data — navigate this record, then follow that pointer, as in relational algebra or the old network DML — and declarative (non-procedural) when the user says only what is wanted, as in SQL and relational calculus. SQL can be typed interactively or embedded in a host language such as C, Java or PHP.
Watch out
Books differ: Oracle's manuals list GRANT, REVOKE, TRUNCATE and RENAME among DDL statements, while most textbooks call GRANT/REVOKE DCL. Some Indian textbooks (Ivan Bayross's Oracle book, for one) even put COMMIT, ROLLBACK and SAVEPOINT under DCL. In MCQs choose DCL for GRANT/REVOKE unless DCL is not an option. TRUNCATE is DDL, not DML — Oracle and MySQL commit it implicitly, so it cannot be rolled back there.
07The people around a database
The database administrator (DBA) is responsible for the database system as a whole. Large organisations may also have a data administrator (DA) who sets policy — what data to keep, who owns it and how it is classified — while the DBA implements that policy technically.
Schema definition — creates the conceptual schema by running DDL statements.
Storage structure and access-method definition — chooses file organisations and indexes.
Schema and physical-organisation modification — evolves the design as requirements change.
Granting authorisation — decides who may access which data (GRANT/REVOKE, roles).
Routine maintenance — periodic backups, recovery after failures, disk-space monitoring and upgrades.
Performance tuning and integrity — monitors the workload, tunes queries and defines integrity constraints.
User type
Who they are and how they interact
Naive (parametric) end users
Run canned transactions through forms — bank tellers, railway-reservation clerks, ATM users
Casual end users
Query occasionally, with different needs each time — managers using a query tool
Sophisticated end users
Write their own SQL or use analysis tools — analysts, scientists, engineers
Standalone users
Maintain a personal database with a ready-made package — a small trader's accounts app
Application programmers
Write programs with embedded SQL or database APIs that naive users then run
Database designers and system analysts
Gather requirements, design the schema and specify the canned transactions
08Codd's rules and database system architectures
In 1985 E. F. Codd published twelve rules (numbered 1–12, plus a foundation Rule 0) that a DBMS must satisfy to be called fully relational. No commercial product meets every rule, but the list is a favourite source of recall questions.
Rule
Name
Gist
0
Foundation rule
The system manages databases entirely through its relational capabilities
1
Information rule
All information is represented as values in tables
2
Guaranteed access
Every value is reachable by table name + primary-key value + column name
3
Systematic treatment of NULL
NULL represents missing or inapplicable data uniformly, distinct from 0 or blank
4
Active online catalog
The data dictionary is relational and queryable with the same language
5
Comprehensive data sublanguage
One language covers definition, manipulation, integrity, authorisation and transactions
6
View updating
Every view that is theoretically updatable can be updated by the system
7
High-level insert, update, delete
Set-at-a-time changes, not only set-at-a-time retrieval
8
Physical data independence
Programs are unaffected by changes in storage
9
Logical data independence
Programs are unaffected by information-preserving changes to tables
10
Integrity independence
Integrity constraints are stored in the catalog, not coded in programs
11
Distribution independence
Users need not know whether or how the data is distributed
12
Non-subversion
A low-level, record-at-a-time interface cannot bypass the integrity rules
Codd's rules (1985)
Centralised systems run the DBMS, the data and the applications on one computer — a mainframe, or SQLite embedded in a single app. Client–server systems split the work: in a 2-tier design the client application sends SQL straight to the database server; in a 3-tier design a browser or thin client talks to an application server that holds the business rules, and only the application server talks to the database server. Three tiers improve security, scalability and maintainability.
A distributed database stores data at several sites connected by a network but presents it as one database. It may be homogeneous (the same DBMS at every site) or heterogeneous, and it relies on fragmentation (horizontal = subsets of rows, vertical = subsets of columns), replication and protocols such as two-phase commit. A parallel database uses many processors and disks to run queries faster, organised as shared memory, shared disk or shared nothing.
Worked examples
Try the problem first, then reveal the working one step at a time.
EX 1Physical or logical data independence?
Classify each change and name the mapping that absorbs it: (a) create an index on emp(salary); (b) add a column email to emp; (c) store emp as a hashed file on emp_id instead of a heap file; (d) split emp into emp_personal(emp_id, ename, hire_date) and emp_job(emp_id, job, salary, dept_id, manager_id), and define a view named emp that joins them; (e) move all data files to SSD.
EX 2Sort the statements into DDL, DML, DCL and TCL
Classify: CREATE VIEW v AS …, TRUNCATE TABLE works_on, GRANT SELECT ON emp TO clerk, SAVEPOINT s1, MERGE INTO emp …, ALTER TABLE emp ADD email VARCHAR(40), COMMIT, UPDATE emp SET salary = salary + 1000.
EX 3Diagnose the file-system failures
A housing board still runs on separate files. Name the drawback behind each incident: (i) a cancelled allotment was recorded in the accounts file but the allotment file still shows the house as taken; (ii) a power cut left an instalment debited from the bank-receipts file but never credited in the ledger; (iii) the chairman wants allottees with arrears above ₹50,000 by district and IT needs two weeks to write the program; (iv) every program checks 'instalment > 0' itself and one program forgot; (v) a contract clerk can open everybody's Aadhaar numbers.
Practice session
Work each problem on paper first, then check. Marking one solved earns 10 XP.0/5 solved
Q1
State the ANSI/SPARC level of each description: (a) 'the receptionist sees ename and dname but never salary'; (b) 'emp rows are stored in a B+ tree clustered on emp_id, 4 KB pages'; (c) 'emp has seven attributes and dept_id references dept(dept_id)'.
Q2
The sample tables are emp (7 columns, 10 rows), dept (3 columns, 4 rows) and works_on (3 columns, 12 rows). Give the degree and cardinality of emp. Then add an email column to emp and delete two employees whom no other row references (say Indu and Jose): what are the new degree and cardinality?
Q3
Classify each person as a naive/parametric, casual, sophisticated or standalone user, or as an application programmer: (a) a railway clerk booking tickets through a fixed screen; (b) a data analyst writing SQL joins for a report; (c) a manager who runs a query tool once a month with new questions; (d) a developer writing the PHP code behind the booking screen; (e) a shopkeeper using a ready-made billing package.
Q4
Name the architecture: (a) a bank keeps each branch's accounts at that branch but answers all-India queries as if it were one database; (b) an accounting package keeps its database file on the same PC; (c) a web portal with browser, application server and database server; (d) a warehouse runs one query across 64 nodes, each with its own CPU, memory and disks.
Q5
Which of Codd's rules does each statement express? (a) every value can be reached by table name, primary-key value and column name; (b) the catalog can be queried with ordinary SQL; (c) missing values are represented by NULL, not by 0 or blanks; (d) moving tables to new disks does not affect programs.
Exam traps
Logical data independence is harder to achieve than physical data independence — a common distractor states the reverse.
Schema = intension (structure, changes rarely); instance = extension (data, changes constantly). The external level has many schemas; the conceptual and internal levels have one each.
Degree counts columns and cardinality counts rows of a relation. In E-R modelling, 'cardinality ratio' means 1:1, 1:N or M:N — a different idea that shares the word.
Codd's '12 rules' are really thirteen: Rule 0 (foundation) plus Rules 1–12.
GRANT/REVOKE are DCL in textbooks but appear under DDL in Oracle's manuals; TRUNCATE is DDL and auto-commits in Oracle and MySQL, so it cannot be rolled back there.
Oldest models: Bachman's IDS (network-style, early 1960s) is usually called the first DBMS, and IBM's IMS (hierarchical, 1966–68) followed; both pre-date Codd's relational model (1970). If an MCQ lists only one of them as 'oldest', choose that one.
Quiz — KPSC style
10 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
DBMS architecture, data models & independence · Question 1 of 10✓ 0 · ✗ 0
Which level of the ANSI/SPARC architecture describes how records are actually stored, including indexes and file organisation?
Past-paper questions on this topic
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.
Past papers · Question 1 of 12✓ 0 · ✗ 0
Modelled on QP 050/2026 · Deputy Manager (IT) / Assistant Programmer / Computer Programmer etc (20 May 2026), Q.51 (reworded)original paper (PDF)
What is the name for one central store that holds metadata — data describing the database's own structure?