Relational Model in DBMS
Fatema Tuj Johora
Lecturer,
Department. of CSE,DIU
Topic of discussion
Relational Model
Relational Model Concepts
Relational Integrity Constraints
Operation in Relational Model
Relational Model
Relational Model was proposed by E.F. Codd
to model data in the form of relations or
tables.
Relational Model represents how data is
stored in Relational Databases.
A relational database stores data in the form
of relations (tables).
Relational Model system
Some popular Relational Database
management systems are:
DB2 and Informix Dynamic Server - IBM
Oracle and RDB – Oracle
SQL Server and Access - Microsoft
Relational Model Concepts
Employee Table
Relational Model Concepts
Tables – In the Relational model the, relations are saved in the table
format. It is stored along with its entities. A table has two properties
rows and columns. Rows represent records and columns represent
attributes.
Attribute: Each column in a Table. Attributes are the properties which
define a relation. e.g., customer_id, customer_name etc.
Tuple – It is nothing but a single row of a table, which contains a single
record.
Relation Schema: A relation schema represents the logical
representation of entire database.
Customer(customer_id, customer_name, status)
Relational Model Concepts
Degree: The total number of attributes which in the
relation is called the degree of the relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a
specific attribute.
Relation instance – Relation instance is a finite set of
tuples in the RDBMS system. Relation instances never
have duplicate tuples.
Attribute domain – Determines the type of data values
that are permitted for that attribute.
Relational Model Concepts
Primary key and foreign key
Primary Key: Is a single field chosen by the designer to
uniquely identify a record in a table (relation),
cannot be null (empty/unassigned)
A FOREIGN KEY is a field (or collection of fields) in one
table, that refers to the PRIMARY KEY in another table.
The table with the foreign key is called the child table, and
the table with the primary key is called the referenced or
parent table.
Primary key and Secondary key
Relational Integrity constraints
Relational Integrity constraints is referred to
conditions which must be present for a valid
relation.
There are many types of integrity constraints.
Constraints on the Relational database
management system is mostly divided into
three main categories are:
Domain constraints
Key constraints
Referential integrity constraints
Domain Constraints
Domain constraints: Valid set of values for an
attibute.
This is specified as data types which include
standard
data types integers, real numbers, characters,
Booleans, variable length strings, etc. Age
in
Emp id Ename Age
1 A 24
2 B x1
C
Key constraints
An attribute that can uniquely identify a tuple
in a relation is called the key of the table.
e.g.; Roll_No in STUDENT is a key. No two
students can have same roll number. So a key
has two properties:
It should be unique for all tuples.
It can’t have NULL values.
=
empid Ename
1 A
2 B
1 C
Referential integrity constraints
Referential integrity constraints is base on
the concept of Foreign Keys.
Referential integrity refers to the accuracy and consistency
of data within a relationship.
Ensures that the foreign key value can be null
or from the primary key table
Referential Integrity
For example, if we delete row number 15 in a
primary table, we need to be sure that there’s
no foreign key in any related table with the
value of 15. We should only be able to delete
a primary key if there are no associated rows.
Otherwise, we would end up with an
orphaned record.
Insert Operation
The insert operation gives values of the
attribute for a new tuple which should be
inserted into a relation.
Update Operation
You can see that in the below-given relation
table CustomerName= 'Apple' is updated
from Inactive to Active.
Delete Operation
You can see that in the below-given relation
table CustomerName= 'Apple' is updated
from Inactive to Active.
Select Operation
You can see that in the below-given relation
table CustomerName= 'Apple' is updated
from Inactive to Active.
Thank you