Module 2 - Part 1
Module 2 - Part 1
Module 2
part 1
INDEX
❑ Relational Model
❑ Relational Model Constraints
❑ ER Model to Relational Model
❑ Relational Algebra
❑ Select
❑ Project
❑ Cartesian product
RELATIONAL MODEL
• The relational model represents
the database as a collection of
relations
• In the formal relational model
terminology,
❑ A row is called a tuple
❑ A column is called an
attribute
❑ The table is called a relation
DOMAIN
❑ A set of atomic values allowed for an attribute
Eg:Student age
RELATION SCHEMA
❑ Describes a relation
❑ Made up of a relation name R and a list of attributes
A1,A2,……..An
Eg:STUDENT(Name,Rollnum,Age)
STUDENT(Name:string,Rollnum:integer,Age:integer)
DEGREE OF A RELATION
❑ Number of attributes in a relation schema
Eg: STUDENT(Name,Rollnum,Age)-degree-3
CARDINALITY
❑ Total number of tuples present in a relation
RELATIONAL MODELS
CONSTRAINTS
• Constraints are the restrictions or the limitations on data in
the database
1. Inherent model-based constraints or implicit constraints:
Constraints that are inherent in the data model
2. Schema-based constraints or explicit constraints:
Constraints that are defined directly in the schemas of the
data model
3. Application-based or semantic constraints or business
rules: Constraints that cannot be directly expressed in the
schemas of the data model, and hence must be
expressed and enforced by the application programs.
SCHEMA BASED CONSTRAINTS
1.DOMAIN CONSTRAINTS
• Must be atomic value
• Performs data type check
2.KEY CONSTRAINTS
• An attribute that can uniquely identify each tuple in a
relation is called a key