Editorial draftGuides

Relational Database (RDBMS): Modeling, Relationships, and SQL Query System

Three ivory paper database tables with blank cells connect through precise red relationship lines and small charcoal key tokens.

Relational Database (RDBMS): Modeling, Relationships, and SQL Query System

A relational database (RDB) is a database system structured according to the relational model of data, introduced by British computer scientist Edgar F. Codd in his seminal 1970 paper. A Relational Database Management System (RDBMS) is the software engine that stores, manages, queries, and updates data formatted as structured relations (tables) comprising tuples (rows) and attributes (columns). Most relational database systems implement Structured Query Language (SQL) as the standardized declarative interface for data definition (DDL), data manipulation (DML), and access control (DCL).

History

Edgar F. Codd first defined the relational model at IBM's San Jose Research Laboratory in June 1970 in his landmark publication, "A Relational Model of Data for Large Shared Data Banks". Codd introduced the mathematical concept of representing business entities and relationships through first-order predicate logic and set theory, formalizing twelve strict rules (Codd's Twelve Rules) that define a true relational database system.

While commercial relational database engines vary in their strict adherence to every theoretical rule, practical systems adhere to foundational relational standards:

  • Tabular Data Representation: Presenting all data to users and applications strictly as relations—tables consisting of distinct rows and named columns.
  • Declarative Data Manipulation Operators: Providing high-level mathematical operators that transform and query tabular data without exposing low-level physical file pointers.

In 1974, IBM launched System R, an influential research project that proved the feasibility of relational architectures and invented Structured English Query Language (SEQUEL), later standardized as SQL. Relational systems quickly commercialized: Multics Relational Data Store was developed in 1976, followed by Relational Software Inc. (later Oracle Corporation) launching the first commercial SQL RDBMS in 1979, and IBM releasing DB2 in 1983.

Early academic implementations of the relational model included:

  • Micro DBMS (1969): University of Michigan.
  • Peterlee Relational Test Vehicle (PRTV, 1973–1979): IBM UK Scientific Centre.
  • Ingres Project (1974): UC Berkeley, which pioneered the QUEL query language and spawned commercial engines including Ingres, Informix, Sybase, and PostgreSQL.

Relational model

Relational Database Entity-Relationship (ER) Schema: Student, Course, and Instructor RelationshipsRelational Database Entity-Relationship (ER) Schema: Student, Course, and Instructor Relationships

The relational model organizes data into one or more named tables (relations). Each table possesses a defined schema comprising fixed columns (attributes) with assigned data types and domains. Each horizontal entry represents a unique row (tuple), representing an individual entity instance (e.g., a customer, product, or ledger entry).

For example, in an enterprise student management database, each row in a Classes table represents a distinct course offering. A course can enroll multiple students whose records reside in a Students table, establishing a one-to-many (1:N) relationship managed through relational keys.

Keys

Relational tables rely on keys to uniquely identify tuples and establish referential relationships across entities:

  • Primary Key (PK): A column or combination of columns chosen to uniquely identify each row in a table. Primary keys must be unique and cannot contain null values. Database engines generate clustered B-Tree indexes on primary keys to optimize retrieval performance. Organizations often utilize surrogate keys (system-generated auto-increment integers or UUIDs) rather than business natural keys to prevent schema instability.
  • Foreign Key (FK): A column in a child table whose values must match the primary key of a parent table. Foreign keys establish logical links between tables, enforcing referential integrity.
  • Junction Tables (Composite Keys): When modeling many-to-many (N:M) relationships (e.g., students enrolling in multiple courses), a junction table is created containing foreign keys referencing both entities, which combine to form a composite primary key.

Relations

Relations model the logical associations between enterprise entities. In relational database design, Entity-Relationship (ER) diagrams establish cardinality (one-to-one, one-to-many, and many-to-many) before physical tables and foreign key constraints are generated.

Transactions

To maintain data integrity under concurrent user access and system failures, enterprise RDBMS engines enforce the ACID transactional guarantees:

  • Atomicity: All operations within a transaction execute successfully, or the entire transaction is rolled back with zero modifications committed.
  • Consistency: Transactions transition the database from one valid state to another, strictly obeying all schema constraints, cascades, and business triggers.
  • Isolation: Concurrent transactions execute independently without mutual interference, managed via transaction isolation levels (Read Committed, Repeatable Read, Serializable) and Multi-Version Concurrency Control (MVCC).
  • Durability: Once a transaction is committed, its modifications survive unexpected hardware power losses and crashes via Write-Ahead Logging (WAL).

Stored procedures

Stored procedures are precompiled collections of SQL statements and procedural logic stored directly within the database catalog. Stored procedures reduce client-server network roundtrips, encapsulate complex business transactions, and enhance database security by granting application roles execute permissions on procedures while restricting direct table read/write access.

Terminology

Relational Data Structure: Attribute Columns, Tuple Rows, and Bounded Relation TableRelational Data Structure: Attribute Columns, Tuple Rows, and Bounded Relation Table

Relational theory uses precise mathematical terminology, which maps directly to familiar SQL database implementations:

SQL Operational TermFormal Relational TermStructural DescriptionPhysical Engine Mapping
Row / RecordTupleDiscrete instance of entity attributesPhysical data page record
Column / FieldAttributeNamed property associated with a data domainTyped column schema
TableRelation / RelvarBounded set of tuples sharing identical schemaStorage heap or clustered index
View / Result SetDerived RelationVirtual relation evaluated via declarative queryDynamic execution plan or materialized view

Relations or tables

In an RDBMS, a table contains an unordered collection of tuples. Schema constraints define valid data types, character encodings, and maximum lengths. Applications query and mutate data declaratively using SQL statements: SELECT queries filter and project tuples, while INSERT, UPDATE, and DELETE statements modify table state within ACID transactions.

Base and derived relations

  • Base Relations: Physical tables whose records are written and persisted directly to non-volatile disk or solid-state storage.
  • Derived Relations: Virtual views and query result sets dynamically computed by executing relational algebra operators against base relations. Views can encapsulate complex joins, enforce row-level security, and simplify application query syntax.

Scope

In relational theory, scope (or domain) defines the set of permissible values assigned to an attribute. A domain acts as an inherent semantic constraint: an integer column will reject string values, while an enumerated field (Order_Status) restricts valid input to specified state strings (Pending, Approved, Shipped).

Restrictions

Constraint restrictions enforce organizational business rules at the database engine level, preventing corrupt data ingestion before it reaches application layers:

Primary key

Ensures entity uniqueness within a relation. Surrogate keys (integers, bigints, or UUIDv4/v7) provide stable, immutable identifiers that shield internal foreign key relationships from external business changes.

Foreign key

Maintains referential integrity across related tables. Foreign key constraints can be configured with cascading behaviors:

  • ON DELETE CASCADE: Automatically deletes child records when the referenced parent record is deleted.
  • ON DELETE RESTRICT / NO ACTION: Aborts deletion if dependent child records exist.
  • ON DELETE SET NULL: Retains child rows while setting their foreign key pointers to null.

Stored procedures

Encapsulate multi-step transaction pipelines, batch data reconciliations, and complex analytical aggregations within database engine execution boundaries.

Indexes

Indexes are auxiliary data structures (predominantly balanced B+ Trees or Hash indexes) created on specific table columns to accelerate search and filter queries. While indexes reduce query latency from full table scans (O(N)) to logarithmic lookups (O(log N)), they introduce write overhead during row insertions, updates, and deletions.

Relational operations

Edgar Codd defined eight core relational algebra operators, divided into foundational set theory operations and specialized relational operators:

  • Union (∪): Merges tuples from two compatible relations, automatically eliminating duplicate records (SQL: UNION).
  • Intersection (∩): Returns only the tuples present simultaneously in both relations (SQL: INTERSECT).
  • Set Difference (−): Extracts tuples present in the first relation that do not exist in the second (SQL: EXCEPT or MINUS).
  • Cartesian Product (×): Generates an unrestricted cross join, pairing every tuple of the first relation with every tuple of the second.
  • Selection (σ): Filters tuples based on specified criteria, implemented via the SQL SELECT ... WHERE clause.
  • Projection (π): Extracts specific columns from a relation while omitting unselected attributes.
  • Natural Join (⋈): Links two relations based on matching attribute values, implemented via SQL INNER JOIN clauses.
  • Division (÷): Identifies tuples in one relation that match all tuples in another related relation.

Relational Database Normalization Tiers & Anomaly Prevention

Normal FormPrimary Structural RequirementRedundancy EliminatedAnomaly PreventedTypical Enterprise Target
1NF (First Normal Form)Atomic column values; unique column names; primary key definedRepeating groups, array strings, and duplicate rowsInability to query individual items within delimited listsMandatory baseline for all tables
2NF (Second Normal Form)Complies with 1NF; zero partial dependencies on composite keysAttributes dependent on only a fraction of a compound primary keyUpdate anomalies where modifying an attribute requires changing multiple rowsStandard operational OLTP target
3NF (Third Normal Form)Complies with 2NF; zero transitive dependencies on non-key attributesAttributes depending on other non-key attributesDeletion anomalies where removing a record inadvertently destroys lookup dataGold standard for transactional RDBMS
BCNF (Boyce-Codd Normal Form)Every determinant must be a candidate keySubtle multi-candidate key functional overlapsEdge-case functional dependency contradictionsMission-critical financial ledgers
Denormalized (OLAP)Deliberate introduction of redundant attributesStar schema / Snowflake analytical dimensionsReplaces expensive multi-table joins with fast sequential scansAnalytical data warehouses (Snowflake, BigQuery)

Normalization

Database normalization systematically decomposes complex tables into smaller, well-structured relations to eliminate duplicate data storage and prevent data modification anomalies:

  • Insertion Anomalies: Inability to record an entity attribute without artificially creating an unrelated entity.
  • Deletion Anomalies: Unintended loss of critical entity data when deleting an adjacent record.
  • Update Anomalies: Inconsistent state resulting from updating a data point in one record while leaving identical data unchanged elsewhere.

RDBMS

Enterprise RDBMS Architecture: Server Instance Memory Model, Process Model, and Disk Storage ModelEnterprise RDBMS Architecture: Server Instance Memory Model, Process Model, and Disk Storage Model

An enterprise RDBMS provides client-server query processing, cost-based query optimization (CBO), memory buffer caching, lock management, automated backup routines, and cryptographic data-at-rest encryption.

Distributed relational databases

Distributed Relational Database Architecture (DRDA) and distributed consensus protocols enable networked database nodes to execute distributed transactions. Modern distributed SQL systems (NewSQL) implement two-phase commit (2PC) and Raft/Paxos consensus algorithms to deliver horizontal scaling across cloud data centers while preserving ACID guarantees.

Database engine list

Prominent enterprise and open-source relational database management systems include:

  • Oracle Database: Industry-leading enterprise transaction engine known for Real Application Clusters (RAC), multi-tenant containers, and mission-critical financial processing.
  • MySQL: The world's most widely deployed open-source web RDBMS, powered by the transactional InnoDB storage engine.
  • Microsoft SQL Server: Comprehensive enterprise relational platform for Windows and Linux, featuring Transact-SQL (T-SQL) and integrated business intelligence tooling.
  • PostgreSQL: Advanced open-source object-relational database renowned for strict SQL standards compliance, extensible types, JSONB indexing, and geospatial extensions (PostGIS).
  • Snowflake: Cloud-native relational analytical data warehouse separating compute and storage for large-scale enterprise analytics.
  • IBM Db2: High-performance enterprise relational engine optimized for mainframe and distributed multi-cloud transactions.
  • SQLite: Self-contained, serverless, zero-configuration SQL database engine embedded in billions of mobile devices and desktop applications.
  • Microsoft Access: Desktop relational file-based database engine used for rapid departmental reporting and prototyping.
  • MariaDB: Community-driven open-source fork of MySQL created by MySQL's original founders, featuring specialized columnar and distributed engines.

For architectures connecting relational databases to distributed API layers, see Article 045, and for content management database designs, explore Article 058.

On this page