Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Introduction to the

Relational Model
The relational model is a conceptual and mathematical model of data
organization. It organizes data into one or more tables (or "relations") of columns
and rows. This model is widely used in database management systems. It
provides a consistent, structured, and effective way to interact with databases.
Key Concepts in the Relational Model
Tables and Rows Attributes and Domains
Relational databases store data in tables Attributes represent the columns, and domains
composed of rows and columns. define the type of data each attribute can hold.

Relationships between Tables Data Integrity and Consistency


Tables can be related through common Relational databases enforce data integrity
attributes, enabling the retrieval of related data. through primary keys, unique constraints, and
foreign keys, ensuring consistent and accurate
data.
rimary Keys and Candidate Keys
Primary Keys Candidate Keys
A primary key uniquely identifies a record in a Candidate keys are the minimal set of attributes
relational database table. that can uniquely identify a record.
Foreign Keys and Referential Integrity
• Foreign Keys: These are attributes in a relational database that provide a link between tables, ensuring data
consistency.
• Referential Integrity: It enforces the relationships between tables, preventing orphaned rows and
maintaining data accuracy.
• Update and Delete Actions: Define the actions when a referenced row is updated or deleted to maintain
data integrity.
Relational Algebra Overview
Relational algebra is a procedural query language that operates on relations, allowing the selection, projection,
union, intersection, difference, and join operations.

It provides a theoretical foundation for relational databases and is essential for understanding database management
and optimization.
Selection and Projection Operations
Selection Operations Projection Operations

Selection is used to extract rows that meet specific Projection is used to extract specific columns from a
conditions from a relation. relation, ignoring the rest of the attributes.

It's like applying a filter to the data, keeping only the


rows that satisfy the given criteria. It's like selecting certain fields to focus on and
discarding the others.
Union and Intersection Operations
• Union: Combines rows from two tables and returns unique rows.
• Intersection: Retrieves common rows from two tables.
• Set Difference: Compares two tables and returns rows that exist in the first table but not in the second.
Difference and Cartesian Product
Operations
Difference Operation
Finds tuples in one relation that are not present in another.

Cartesian Product Operation


Produces a combination of all possible pairs of tuples from two relations.

Application in Query Optimization


Understanding these operations is crucial for optimizing relational database queries.
Join Operations

Merge Connect Merge Tables


Combining rows from two or Linking data from different tables Bringing together data from
more tables based on a related by matching specified columns. multiple tables to create a new
column. result set.
Division and Renaming Operations
Division Operation The division operation in relational algebra is used
to find all tuples in one relation that are associated
with all tuples in another relation.

Renaming Operation The renaming operation in relational algebra is


used to rename the attributes of a relation,
providing alias names for the attributes.

You might also like