Relational Database

A relational database follows the principles of relational algebra and is based on a structured schema. The data is stored in tables, where each table consists of unique rows, and each row has attributes that define the characteristics of the stored data. The relational model was introduced by Edgar F. Codd in 1970 and has since become the foundation of modern databases.

A relational database is a type of database that organizes data into structured tables (relations) consisting of rows (records) and columns (attributes) while enforcing relationships between them using primary and foreign keys.

A relational database ensures data integrity through primary keys (unique identifiers for each record) and foreign keys (links between different tables). This structure reduces redundancy and maintains consistency across different data entities. For example, in an e-commerce system, there might be separate tables for Customers, Orders, and Products, linked through foreign keys to maintain relationships between them.

Relational databases use Structured Query Language (SQL) for managing data. SQL provides commands for inserting, updating, deleting, and retrieving data from tables. Most enterprise applications, such as banking systems, airline reservation systems, and content management systems, rely on relational databases for efficient data management.

CREATE TABLE Customers (
    customer_id INT PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(100)
);

CREATE TABLE Orders (
    order_id INT PRIMARY KEY,
    customer_id INT,
    product VARCHAR(50),
    amount DECIMAL(10,2),
    FOREIGN KEY (customer_id) REFERENCES Customers(customer_id)
);