RDB
A relational database (RDB) is a structured data storage system that organizes information into tables (rows and columns). These tables are linked through common fields (keys), ensuring data consistency and integrity across an application. Most relational databases use SQL (Structured Query Language) for data definition and manipulation, making it straightforward to query, insert, update, or delete data. Commonly employed in e-commerce, financial services, and content management systems, relational databases excel at handling transactions (ACID properties) and maintaining reliable data relationships.
Also known as: SQL database, relational DBMS
Comparisons
- Relational Database vs. NoSQL: While RDBs follow predefined schemas and structured tables, NoSQL databases store unstructured or semi-structured data with flexible schemas.
- Relational Database vs. Hierarchical Database: Hierarchical databases organize data in tree-like structures, whereas RDBs use tabular relationships and joins.
Pros
- Data integrity: ACID compliance ensures reliable transactions and consistency.
- Powerful querying: SQL offers advanced joins, aggregations, and filtering.
- Mature ecosystem: Decades of usage, rich tooling, and strong community support.
Cons
- Rigid schema: Structural changes can be time-consuming when requirements evolve.
- Scalability challenges: Scaling horizontally (sharding) can be more complex than with some NoSQL options.
Example
An online store might maintain tables for Customers, Products, Orders, and OrderItems, linking them with keys (e.g., customer_id and product_id). This setup ensures consistent data, prevents invalid entries, and enables powerful queries—such as calculating the total revenue for a given day or retrieving a list of orders for a specific customer.