Skip to content
Dev Dump

Database Management System (DBMS)

Database overview

  • Database - the organized collection of data.
  • DBMS - the software layer that provides APIs, query engines, storage management, and security on top of the raw data.
ModelStructureHighlightsExamples
HierarchicalTree (parent -> children)Fast traversals for fixed hierarchiesIMS
NetworkGraph (nodes/edges)Supports many-to-many relationshipsIDMS
Relational (RDBMS)Tables (rows/columns)SQL, strong integrity constraintsPostgreSQL, MySQL
Object-OrientedObjects with methodsBlends OOP with persistenceObjectDB
NoSQL (document, key-value, column, graph)Flexible schemasScale-out, event-driven appsMongoDB, Cassandra

The Entity-Relationship (ER) model captures data requirements at a conceptual level.

ER model

ER components

  • Simple: indivisible values
    Simple attribute
  • Primary key: uniquely identifies each entity instance
    Primary key attribute
  • Derived: computed from other attributes
    Derived attribute
  • Multivalued: multiple values per entity (requires junction table in RDBMS)
    Multivalued attribute
  • Composite: attributes with subparts (e.g., address)
    Composite attribute
  1. One-to-One: rare; use when splitting sensitive or optional data.
  2. One-to-Many: most common; foreign key lives on the “many” side.
  3. Many-to-Many: resolve via a junction table with two foreign keys.
Integrity TypeEnforced ByPurpose
EntityPrimary key (PRIMARY KEY)Ensures every row is identifiable and non-null
ReferentialForeign key (FOREIGN KEY)Keeps relationships valid between tables
DomainData types, CHECK, NOT NULL, defaultsRestricts column values to valid ranges/formats
User-definedTriggers, stored procedures, application logicEncodes business-specific rules

A transaction is a logical unit of work that respects ACID properties.

Transaction lifecycle

StateDescription
ActiveExecuting operations (reads/writes)
Partially committedIn-memory changes done; waiting to flush/commit
CommittedChanges durably persisted; cannot roll back
FailedError detected; rollback initiated
TerminatedTransaction ends after commit or abort