What Is a Relational Database?

Site Admin · 11 Sep 2026 · 6 views

What Is a Relational Database?

Organizing Data in Tables

A database is an organized collection of data. A relational database stores that data in tables, which look like spreadsheets: rows and columns. Each row is one record, and each column holds one attribute of the record. The word relational comes from the fact that tables can relate to one another through shared keys.

Consider a shop. A customers table stores each buyer with an id, name, and email. An orders table stores each order, referencing the customer who placed it and the product purchased. This structure removes duplication: the customer name is stored once, not repeated in every order row.

Why Tables Beat Spreadsheets

Spreadsheets work for one-off analysis, but they struggle with concurrent access, large datasets, and integrity rules. Relational databases provide several guarantees:

  • ACID transactions keep operations reliable.
  • Constraints such as NOT NULL and UNIQUE protect data quality.
  • A powerful query language, SQL, answers complex questions in one statement.
  • Indexes keep queries fast even on millions of rows.

Rows, Columns, and Keys

Every table has a primary key, a column (or combination of columns) that uniquely identifies each row, usually an integer named id. Foreign keys reference a primary key in another table and are how relationships are expressed.

customers (id, name, email)
orders (id, customer_id, product, total)

Here orders.customer_id is a foreign key pointing to customers.id. A foreign key value must exist in the referenced table, or the insert is rejected, which prevents dangling references.

Relationships Between Tables

Three relationship types dominate. One-to-one pairs a row with at most one row in another table, such as a user and their profile. One-to-many is the most common, such as one customer with many orders. Many-to-many needs a join table, such as students and courses linked through an enrollments table.

Key Points

  • Relational databases store data in tables of rows and columns.
  • Primary keys uniquely identify rows; foreign keys create relationships.
  • Normalized design stores facts once instead of duplicating them.
  • SQL queries relational data in one readable statement.
  • Constraints and transactions keep data correct and consistent.
Share this post:

Comments (0)

Please login or register to comment.