Chapter 3 Part 1
Chapter 3 Part 1
Chapter 3 Part 1
➢ The relational model in DBMS is an approach to logically represent and manage the
data stored in a database. In this model, the data is organized into a collection of two-
dimensional inter-related tables, also known as relations. Each relation is a
collection of columns and rows, where the column represents the attributes of an entity
and the rows (or tuples) represent the records.
➢ Consider a case where you wish to store the name, the CGPA attained, and the roll
number of all the students of a particular class. This structured data can be easily stored
in a table as described below:
Terminology
• Relation: Two-dimensional table used to store a collection of data elements.
• Tuple: Row of the relation, depicting a real-world entity.
• Attribute/Field: Column of the relation, depicting properties that define the relation.
• Attribute Domain: Set of pre-defined atomic values that an attribute can take i.e., it
describes the legal values that an attribute can take.
• Degree: It is the total number of attributes present in the relation.
• Cardinality: It specifies the number of entities involved in the relation i.e., it is the
total number of rows present in the relation.
• Relational Schema: It is the logical blueprint of the relation i.e.; it describes the design
and the structure of the relation. It contains the table name, its attributes, and their types:
Highlights:
• Simple and Easy to Use - Storing data in tables is much easier to understand and
implement as compared to other storage techniques.
• Manageability - Because of the independent nature of each relation in a relational
database, it is easy to manipulate and manage. This improves the performance of the
database.
• Query capability - With the introduction of relational algebra, relational databases
provide easy access to data via high-level query language like SQL.
• Data integrity - With the introduction and implementation of relational constraints,
the relational model can maintain data integrity in the database.
• The performance of the relational model depends upon the number of relations
present in the database.
• Hence, as the number of tables increases, the requirement of physical memory
increases.
• The structure becomes complex and there is a decrease in the response time for the
queries.
• Because of all these factors, the cost of implementing a relational database increase.
There are many types of Integrity Constraints in DBMS. Constraints on the Relational
database management system is mostly divided into four main categories are:
1. Domain Constraints
2. Key Constraints
3. Entity Integrity Constraints
4. Referential Integrity Constraints
Domain Constraints
These are attribute-level constraints. An attribute can only take values that lie inside the
domain range. e.g.; If a constraint AGE>0 is applied to STUDENT relation, inserting a
negative value of AGE will result in failure.
Key Integrity
Every relation in the database should have at least one set of attributes that defines a tuple
uniquely. Those set of attributes is called keys. e.g.; ROLL_NO in STUDENT is key. No two
students can have the same roll number. So, a key has two properties:
i. It should be unique for all tuples.
ii. It can’t have NULL values.
Here, Department table contain one key element that is 1 but in student table we have two
foreign key elements 1 and 6. 1 is present in both table so it validates but 6 is not present so it
will be an error.