A Relational Database is a type of database that organizes data into tables (called relations) consisting of rows and columns. It follows strict mathematical principles based on the relational model proposed by Edgar F. Codd. Relational databases are the most widely used database systems in the world and form the foundation of most business applications, banking systems, ERP software, and web applications.

Popular relational database systems include:

  • MySQL

  • PostgreSQL

  • Oracle Database

  • Microsoft SQL Server

The relational model focuses on:

  • structured data

  • relationships between tables

  • integrity constraints

  • efficient querying using SQL


What is a Relational Database?

A relational database stores data in tables where:

  • Rows represent records (tuples).

  • Columns represent attributes (fields).

  • Relationships between tables are created using keys.

The main idea is that related data can be stored separately but connected logically through relationships.


Real-Life Analogy

A relational database is similar to a collection of organized spreadsheets:

  • each sheet stores a specific type of data

  • rows store individual entries

  • columns define categories of information

Unlike simple spreadsheets, relational databases:

  • enforce rules

  • prevent inconsistencies

  • support relationships between tables

  • allow powerful querying using SQL


Structure of a Relational Database

A relational database mainly consists of:

  • relations (tables)

  • tuples (rows)

  • attributes (columns)

  • domains

  • keys

  • constraints


1. Relation (Table)

A relation is a table that stores related data.

Example:

STUDENT Table

Roll_No | Name  | Age | Branch
--------------------------------
1       | Aman  | 20  | CSE
2       | Riya  | 19  | ECE
3       | Kunal | 21  | ME

Characteristics:

  • rows are unique

  • columns represent attributes

  • data is structured and organized


2. Tuple (Row)

A tuple is a single row in a table.

Example:

(1, Aman, 20, CSE)

This tuple represents one student record.


3. Attribute (Column)

Attributes are the columns of a relation.

Example:

  • Roll_No

  • Name

  • Age

  • Branch

Each attribute stores one type of information.


4. Domain

A domain defines the set of valid values for an attribute.

Examples:

  • Age → integers between 18–30

  • CGPA → decimal values between 0–10

  • Branch → {CSE, ECE, ME, CE}

Domains help maintain valid and meaningful data.


Keys in Relational Databases

Keys are attributes used to uniquely identify rows and establish relationships.


1. Super Key

A super key is any set of attributes that uniquely identifies rows.

Examples:

  • {Roll_No}

  • {Roll_No, Name}

  • {Roll_No, Branch}

Even extra unnecessary attributes are allowed.


2. Candidate Key

A candidate key is a minimal super key.

Example:

  • {Roll_No}

  • {Email}

No attribute can be removed while still maintaining uniqueness.


3. Primary Key

A primary key is the chosen candidate key used as the main identifier.

Properties:

  • unique

  • NOT NULL

  • stable

Example:

Primary Key: Roll_No

4. Foreign Key

A foreign key references the primary key of another table.

Example:

ENROLLMENT Table

Roll_No | Course_ID
-------------------
1       | C101
2       | C102

Here:

  • Roll_No references STUDENT(Roll_No)

Foreign keys maintain referential integrity between tables.


Constraints in Relational Databases

Constraints enforce rules and maintain data integrity.


1. Domain Constraint

Restricts valid values for attributes.

Example:

  • Age >= 18

  • Salary > 0


2. Key Constraint

Ensures uniqueness of keys.

No two rows can have the same primary-key value.


3. Entity Integrity

Primary-key attributes cannot be NULL.

Every row must have a valid identifier.


4. Referential Integrity

Foreign-key values must exist in the referenced table.

This prevents orphan records.


5. Other SQL Constraints

Common SQL constraints include:

  • NOT NULL

  • UNIQUE

  • CHECK

  • DEFAULT


Entity Relationship (ER) Model

Before creating tables, databases are usually designed using the ER Model.

The ER model acts as a conceptual blueprint.


Components of ER Model

Entities

Real-world objects.

Examples:

  • STUDENT

  • COURSE

  • EMPLOYEE

Attributes

Properties of entities.

Example:

  • STUDENT(Name, Roll_No, Branch)

Relationships

Connections between entities.

Example:

  • STUDENT enrolls in COURSE


ER Diagram Example

[STUDENT] ---- (ENROLLS) ---- [COURSE]

This shows:

  • many students can enroll in many courses


Relationship Types

One-to-One (1:1)

One entity relates to one entity.

Example:

  • PERSON ↔ PASSPORT

One-to-Many (1:M)

One entity relates to many entities.

Example:

  • DEPARTMENT → EMPLOYEE

Many-to-Many (M:N)

Many entities relate to many entities.

Example:

  • STUDENT ↔ COURSE


Relational Algebra

Relational algebra is the mathematical foundation of relational databases.

SQL queries internally correspond to relational-algebra operations.


Basic Relational Algebra Operations

OperationSymbolExample
Selectionσσ Branch='CSE'(STUDENT)
Projectionππ Name,Age(STUDENT)
JoinSTUDENT ⋈ ENROLLMENT
UnionTABLE1 ∪ TABLE2
DifferenceTABLE1 − TABLE2

SQL Example: Creating a Relational Database

Create STUDENT Table

Create COURSE Table

Create ENROLLMENT Table

Insert Data

Query Example

Find all CSE students enrolled in DBMS.

Advantages of Relational Databases

Structured Data Storage

Data is organized cleanly into tables.

Data Integrity

Constraints maintain correctness and consistency.

Powerful Querying

SQL provides flexible and efficient querying.

Data Independence

Applications remain independent from storage details.

Security

Supports authentication, permissions, and encryption.

Standardization

Relational databases follow standard SQL principles.

ACID Transactions

Supports:

  • Atomicity

  • Consistency

  • Isolation

  • Durability

which are essential for reliable transactions.


Limitations of Relational Databases

Rigid Schema

Schema changes may be difficult in large systems.

Vertical Scaling

Scaling often requires stronger hardware.

Join Overhead

Complex joins may reduce performance on huge datasets.

Less Suitable for Unstructured Data

Not ideal for rapidly changing or highly flexible data.


Relational Database vs NoSQL Database

FeatureRelational DatabaseNoSQL Database
StructureTablesDocs/KV/Graphs
SchemaFixedFlexible
Query LanguageSQLVaries
TransactionsACIDBASE/Eventual
ScalingVerticalHorizontal
Best ForStructured dataBig/unstructured data

Where Relational Databases Are Used?

Relational databases are heavily used in:

  • banking systems

  • ERP software

  • payroll systems

  • inventory systems

  • airline reservation systems

  • e-commerce applications

  • hospital management systems

because these applications require:

  • consistency

  • transactions

  • strong integrity rules


Why Relational Databases Matter?

Relational databases became dominant because they provide:

  • mathematical correctness

  • strong consistency

  • structured design

  • efficient querying

  • reliable transaction support

They remain the backbone of most enterprise applications today.


Summary

A Relational Database organizes data into structured tables consisting of rows and columns. It uses keys, constraints, and relationships to maintain data integrity and enable efficient querying using SQL. Built on the relational model and relational algebra, relational databases provide reliable, secure, and standardized data management for modern applications. Popular systems like MySQL and PostgreSQL continue to power most business-critical software worldwide.