UNIT 2
1.Relational Database Model
1. Introduction
• The Relational Database Model was proposed by Dr. E.F.
Codd in 1970 in his landmark paper “A Relational Model
of Data for Large Shared Data Banks”.
• It is the most widely used model in modern RDBMS such
as Oracle, MySQL, SQL Server, PostgreSQL, and DB2.
• In this model, data is represented in the form of relations
(tables) consisting of rows (tuples) and columns
(attributes).
• Each relation corresponds to a real-world entity (e.g.,
Student, Employee, Product).
• The model is based on:
o Set Theory → for organizing data.
o First-Order Predicate Logic → for data manipulation
and retrieval.
• It provides a simple, flexible, and mathematically sound
approach to database design and query processing.
Page | 1
, UNIT 2
• Relational databases ensure data integrity, consistency, and
independence through the use of keys and constraints.
1.1. Key Concepts
1. Relation (Table):
o A collection of rows and columns.
o Each relation represents an entity (e.g., Student,
Employee).
2. Tuple (Row/Record):
o A single entry in a relation.
o Represents an instance of an entity.
3. Attribute (Column/Field):
o Represents a property or characteristic of an entity.
o Each attribute has a data type (e.g., INT, VARCHAR).
4. Domain:
o The set of possible values an attribute can take.
5. Degree:
o Number of attributes in a relation.
6. Cardinality:
o Number of tuples in a relation.
1.2. Structure of Relational Model
The structure of the relational model is based on the organization of data into relations (tables).
Each relation is made up of:
1. Relation (Table):
o A collection of tuples (rows) and attributes (columns).
o Example: STUDENT (Roll_No, Name, Dept, Age)
2. Tuple (Row/Record):
o A single record in the table.
Page | 2
, UNIT 2
o Example: (101, “Rahul”, “CSE”, 20)
3. Attribute (Column/Field):
o Represents a property of the entity.
o Example: Roll_No, Name, Dept, Age
4. Domain:
o The set of all possible valid values an attribute can take.
o Example: For Age → Domain = {15–30}
5. Degree:
o Number of attributes (columns) in a relation.
6. Cardinality:
o Number of tuples (rows) in a relation.
Thus, the relational model structure = Relations + Tuples + Attributes + Domains
1.3 Types of Keys in Relational Model
Keys are special attributes (or a set of attributes) used to uniquely identify tuples in a relation
and establish relationships between tables.
(a) Super Key
• A set of one or more attributes that can uniquely identify tuples in a relation.
• Example: {Roll_No}, {Roll_No, Name}
(b) Candidate Key
• Minimal super key (no unnecessary attributes).
• Example: {Roll_No}
(c) Primary Key
• One chosen candidate key that uniquely identifies each tuple.
• Cannot have NULL values.
• Example: Roll_No in STUDENT table.
(d) Alternate Key
• Candidate keys not chosen as the primary key.
• Example: If both Roll_No and Email are candidate keys, and Roll_No is primary →
Email is alternate key.
Page | 3
1.Relational Database Model
1. Introduction
• The Relational Database Model was proposed by Dr. E.F.
Codd in 1970 in his landmark paper “A Relational Model
of Data for Large Shared Data Banks”.
• It is the most widely used model in modern RDBMS such
as Oracle, MySQL, SQL Server, PostgreSQL, and DB2.
• In this model, data is represented in the form of relations
(tables) consisting of rows (tuples) and columns
(attributes).
• Each relation corresponds to a real-world entity (e.g.,
Student, Employee, Product).
• The model is based on:
o Set Theory → for organizing data.
o First-Order Predicate Logic → for data manipulation
and retrieval.
• It provides a simple, flexible, and mathematically sound
approach to database design and query processing.
Page | 1
, UNIT 2
• Relational databases ensure data integrity, consistency, and
independence through the use of keys and constraints.
1.1. Key Concepts
1. Relation (Table):
o A collection of rows and columns.
o Each relation represents an entity (e.g., Student,
Employee).
2. Tuple (Row/Record):
o A single entry in a relation.
o Represents an instance of an entity.
3. Attribute (Column/Field):
o Represents a property or characteristic of an entity.
o Each attribute has a data type (e.g., INT, VARCHAR).
4. Domain:
o The set of possible values an attribute can take.
5. Degree:
o Number of attributes in a relation.
6. Cardinality:
o Number of tuples in a relation.
1.2. Structure of Relational Model
The structure of the relational model is based on the organization of data into relations (tables).
Each relation is made up of:
1. Relation (Table):
o A collection of tuples (rows) and attributes (columns).
o Example: STUDENT (Roll_No, Name, Dept, Age)
2. Tuple (Row/Record):
o A single record in the table.
Page | 2
, UNIT 2
o Example: (101, “Rahul”, “CSE”, 20)
3. Attribute (Column/Field):
o Represents a property of the entity.
o Example: Roll_No, Name, Dept, Age
4. Domain:
o The set of all possible valid values an attribute can take.
o Example: For Age → Domain = {15–30}
5. Degree:
o Number of attributes (columns) in a relation.
6. Cardinality:
o Number of tuples (rows) in a relation.
Thus, the relational model structure = Relations + Tuples + Attributes + Domains
1.3 Types of Keys in Relational Model
Keys are special attributes (or a set of attributes) used to uniquely identify tuples in a relation
and establish relationships between tables.
(a) Super Key
• A set of one or more attributes that can uniquely identify tuples in a relation.
• Example: {Roll_No}, {Roll_No, Name}
(b) Candidate Key
• Minimal super key (no unnecessary attributes).
• Example: {Roll_No}
(c) Primary Key
• One chosen candidate key that uniquely identifies each tuple.
• Cannot have NULL values.
• Example: Roll_No in STUDENT table.
(d) Alternate Key
• Candidate keys not chosen as the primary key.
• Example: If both Roll_No and Email are candidate keys, and Roll_No is primary →
Email is alternate key.
Page | 3