Relational Model

The relational model is the theoretical foundation of relational databases - it represents data as a collection of tables (called relations), where each table consists of rows (tuples) and columns (attributes).

Key Concepts

  • Relation (Table) - a collection of related data organized in rows and columns
  • Tuple (Row) - a single record in a table
  • Attribute (Column) - a named property that every row in the table has
  • Primary Key - a column (or set of columns) that uniquely identifies each row
  • Foreign Key - a column that references the primary key of another table, linking the two together

Example

-- customers table
customer_id | first_name | city
1           | Riya       | Noida
2           | Aman       | Delhi

-- orders table
order_id | customer_id | amount
101      | 1           | 2500
102      | 2           | 1800

Here, customer_id in the orders table is a foreign key referencing the customers table - this relationship is what gives the "relational" model its name.

The relational model was designed to minimize data duplication by splitting information across related tables rather than storing everything in one giant table.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course