Relational Database
- Data is stored in structured tables.
- Tables are connected via common columns (keys) so information can be linked across tables.
- Common examples: a retail customer/orders/products database and a library books/patrons/loans database.
Definition
Section titled “Definition”A relational database is a type of database that stores data in a structured format, using tables and relationships between them. It is called “relational” because the tables are related to each other through common columns, known as keys.
Explanation
Section titled “Explanation”Data is organized into tables that hold related records (for example, customers, orders, or products). Relationships between tables are established by using a column that appears in multiple tables (a key). By matching values in these common columns, information from one table can be linked to and combined with information from another table, enabling queries that span related data.
Examples
Section titled “Examples”Retail store customer database
Section titled “Retail store customer database”This database contains multiple tables, such as:
- customers: information about each customer (name, address, phone number).
- orders: information about each order (date of order, product(s) purchased, price).
- products: information about each product (product name, description, price).
A common column like customer ID appears in the customers and orders tables (and is described as appearing in the products table in the source). The customer ID value links records across tables so related information can be retrieved together.
Library database
Section titled “Library database”This database contains tables for:
- books: information about each book (title, author, ISBN number).
- patrons: information about each patron (name, address, phone number).
- loans: information about each book loaned out (patron ID, book ID, loan date).
Common columns such as patron ID and book ID appear in the loans table and the respective patrons and books tables, allowing records to be linked based on those IDs.
Related terms
Section titled “Related terms”- Tables
- Columns
- Keys (common columns used to relate tables)