1.1 What is a DBMS? & File System vs DBMS
A Database Management System (DBMS) is specialized system software that enables users and applications to create, store, retrieve, update, and manage data in an organized, structured manner. Rather than scattering records across unstructured flat files, a DBMS sits centrally between user applications and physical data files on disk, ensuring concurrent access, security, consistency, and crash recovery.
Figure 1.1: A modern DBMS resolves the data redundancy, inconsistency, isolation, and concurrency bugs of raw file systems.
Key Advantages of a DBMS
- Data Independence: Application programs are separated from physical storage formats and access paths.
- Integrity Enforcement: Primary keys, foreign keys, unique constraints, and check constraints prevent corrupted or orphan data.
- Safe Concurrent Access: Thousands of users can query and update records simultaneously without overwriting each other's changes.
- Declarative Querying: SQL lets users specify what data to retrieve without writing low-level imperative loops.
1.2 Three-Schema Architecture & Data Independence
Proposed by ANSI/SPARC, the Three-Schema Architecture separates the database into three abstraction levels to achieve Data Independence ā shielding application programs from knowing how data is physically laid out on disk.
Figure 1.2: The Three-Schema architecture guarantees that changing the conceptual schema doesn't break external views, and changing disk storage doesn't alter tables.
Two Forms of Data Independence
- Logical Data Independence: The capacity to modify the conceptual schema (e.g., adding a new table, adding an attribute, or modifying column definitions) without having to alter existing external views or rewrite user applications.
- Physical Data Independence: The capacity to modify the internal physical schema (e.g., migrating to SSDs, changing file organization, adding a B-Tree index, compressing disk blocks) without changing the conceptual logical schema.
1.3 Types of DBMS
Database management systems are classified by their underlying data model and how records and relationships are structured in memory and on disk.
Major DBMS Categories
- Relational DBMS (RDBMS): Stores data in two-dimensional tables (relations) of rows (tuples) and columns (attributes) interconnected by primary and foreign keys. Enforces strict schema, ACID compliance, and uses SQL. Examples: PostgreSQL, MySQL, Oracle, Microsoft SQL Server.
- Hierarchical Databases: Organizes data into an inverted tree-like parent-child structure where each child record has exactly one parent (1:N only). Rarely used in modern software (e.g., IBM IMS).
- Network Databases: Allows records to have multiple parent records (graph structure), supporting M:N relationships directly. Replaced by the relational model due to complex pointer navigation.
- NoSQL Databases: Non-relational, schema-flexible data stores designed for high horizontal scalability and massive unstructured or semi-structured data:
- Document Stores: JSON/BSON records (MongoDB, CouchDB).
- Key-Value Stores: High-speed in-memory caches (Redis, DynamoDB).
- Columnar Databases: Optimized for analytical aggregations (Apache Cassandra, ClickHouse).
- Graph Databases: Optimized for interconnected network traversal (Neo4j).