0% found this document useful (0 votes)
2 views

Relational Data Model

The relational data model, proposed by Ted Codd in the 1970s, organizes data into tables (relations) that consist of rows (tuples) and columns (attributes), allowing for a high degree of data independence and ease of use. Key concepts include relation schema, degree, cardinality, and various integrity constraints that ensure data validity. While it offers advantages such as simplicity and scalability, it may also face limitations like field length restrictions and complexity as data grows.

Uploaded by

makureya1997
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Relational Data Model

The relational data model, proposed by Ted Codd in the 1970s, organizes data into tables (relations) that consist of rows (tuples) and columns (attributes), allowing for a high degree of data independence and ease of use. Key concepts include relation schema, degree, cardinality, and various integrity constraints that ensure data validity. While it offers advantages such as simplicity and scalability, it may also face limitations like field length restrictions and complexity as data grows.

Uploaded by

makureya1997
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Relational Data Model

The relational data model provides conceptual tools to design the database
schema of the relational database. The relational model describes the data,
relationship between that data, data sematic and constraints on the data in the
relational database. The relational model expresses the data and relationship among
the data in the form of tables.

What is Relational Model?

Relational Data Model was first prosed by Ted Codd of IBM in the 1970s. But, its
commercial implementations were observed in the 1980s. The relational data model
is employed for storing and processing the data in the database.

The building blocks of the relational model has been developed on the concept
of mathematical relation. And its theoretical concepts are based on set
theory and first-order predicate logic. The relational model is also referred to as
the record-based model as it frames the database in fixed-format records of
various types.

A relational model is popular for its simplicity and possibility of hiding the low-level
implementation details from database developer and database users.

Relational data model expresses the databases a s a set of relations (tables of


values). Each relation has columns and rows which are formally called attributes and
tuples respectively. Each tuple in relation is a real-world entity or relationship. The
name of the relation and the name of attributes contribute to interpreting the sense of
each tuple like it expresses what kind of entities does a relation have

Let us count points to understand the relational model in short:

• The database is a set of related relations (table of values).


• Each relation has a name which indicates what type of tuples the relation
has. For example, a relation named ‘Student’ indicates that it has student
entities in it.
• Each relation has a set of attributes (column names) which represents, what
type of information, the entities or tuples have? For example, Student relation
has a set of attributes Roll_No., Name, Department. It indicates that the
Student relation has student entities/tuples that have information about their
roll_no., name and department.
• A tuple (row) in a relation, is a real-world entity, it has a set of values for
corresponding attributes.
• Each data value in a row or tuple is called field.

Relation Data Model 1


• Relation Schema: A relation schema represents the name of the relation with
its attributes.
• 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.
• Relation instance – Relation instance is a finite set of tuples in the RDBMS
system. Relation instances never have duplicate tuples.
• Relation key - Every row has one, two or multiple attributes, which is called
relation key.
• Attribute domain – Every attribute has some pre-defined value and scope
which is known as attribute domain

Relational Model Objectives


The relational model's objectives were specified as follows:

• To allow a high degree of data independence, application programs must not be


affected by alterations to the internal data representation, mostly by changes to
file organizations or access paths.
• To provide considerable grounds for dealing with data semantics, reliability, and
redundancy problems. In particular, Codd's theory for the relational model
introduced the concept of normalized relations, were relations that have no
repeating groups, and the process is called normalization.
• To allow the expansion of set-oriented data manipulation languages.

Relational Model Diagram


The figure below indicates a relation in a relational model.

It is a Student relation and it is having entries of 5 students (tuples) in it. The figure
below will help you identify the relation, attributes, tuples and field in a relational model.

Relation Data Model 2


Characteristics of Relational Database Model
As we know we have several relations in a database. Now, each relation must be
uniquely identified. If it is not so, then it would create a lot of confusion. Here, we will
discuss some characteristics that when followed will automatically make a relation
distinct in a database.
1. Each relation in a database must have a distinct or unique name which
would separate it from the other relations in a database.
2. A relation must not have two attributes with the same name. Each attribute
must have a distinct name.
3. Duplicate tuples must not be present in a relation.

4. Each tuple must have exactly one data value for an attribute. For example,
below in the first table, you can see that for Roll_No. 265 we have enrolled two
students Jhoson and Charles, this would not work. We must have only one
student for one Roll_No.

Relation Data Model 3


5. Tuples in a relation do not have to follow a significant order as the relation is
not order-sensitive.
6. Similarly, the attributes of a relation also do not have to follow certain ordering,
it’s up to the developer to decide the ordering of attributes.

Relational Model Constraints


Relational model constraints are restrictions specified to the data values in the
relational database. Initially, we will describe the constraints on the database, they
are categorized as follows:

• Inherent Model-Based Constraints: The constraints that are implicit in a data


model are inherent model-based constraints. For example, a relation in a database
must not have duplicate tuples, there is no constraint in the ordering of the tuples
and attributes.
• Schema-Based Constraints: The constraints that are specified while defining
the schema of a database using DDL are schema-based constraints. They are
further categorized as domain constraints, key constraints, entity integrity
constraints, referential integrity constraints and constraints on Null Value.
• Application-based Constraints: The constraints that cannot be applied while
defining the database schema are expressed in application programs. For
example, the salary of an employee cannot be more than his supervisor.

Now let us explore the Schema-based constraints in detail:

Domain Constraints
• Each attribute in a tuple is declared to be of a particular domain (for example,
integer, character, Boolean, String, etc.) which specifies a constraint on the
values that an attribute can take.
• Domain constraints specify that within each tuple, and the value of each
attribute must be unique. This is specified as data types which include
standard data types integers, real numbers, characters, Booleans, variable
length strings, etc.

Relation Data Model 4


Example:

Create DOMAIN CustomerName


CHECK (value not NULL)

The example shown demonstrates creating a domain constraint such that


CustomerName is not NULL

Key Constraint and Constraint on Null Values


• In relation, a key can either be a single attribute or a subgroup of
attributes that can recognize a particular tuple in a relation. Now, the key
constraint specifies that a key (attribute/subset of attribute) must not have the
same set of values for the tuples in a relation.
• The constraint on NULL values defines whether an attribute is allowed to carry
Null value or not. For example, in a student tuple, its name attribute must be
NOT NULL.

Example:

In the given table, CustomerID is a key attribute of Customer Table. It is most likely to
have a single key for one customer, CustomerID =1 is only for the CustomerName ="
Google".

CustomerID CustomerName Status


1 Google Active
2 Amozon Active
3 Apple Inactive

Entity Integrity Constraint:


Entity integrity constraint specifies that a primary key of a tuple can never be NULL.
As primary key used to identify individual tuple in a relation.

Referential Integrity Constraint:


The referential integrity constraint holds if the foreign key of relation R1 that refers
to the relation R2 satisfies following two conditions:

• The set of attributes that form foreign key of relation R1 should have the same
domain as the primary key of the referenced relation R2.
• In the current state, the set of values of the foreign key in tuple t1 of relation
R1 must match a primary key value in referenced relation R2 or it could
be NULL.

Relation Data Model 5


Example

In the above example, we have 2 relations, Customer and Billing.


Tuple for CustomerID =1 is referenced twice in the relation Billing. So, we know
CustomerName=Google has billing amount $300

Operations in Relational Model


Four basic update operations performed on relational database model are Insert,
update, delete and select.

• Insert is used to insert data into the relation


• Delete is used to delete tuples from the table.
• Modify allows you to change the values of some attributes in existing tuples.
• Select allows you to choose a specific range of data.

Whenever one of these operations are applied, integrity constraints specified on the
relational database schema must never be violated.

Insert Operation

The insert operation gives values of the attribute for a new tuple which should be
inserted into a relation.

Relation Data Model 6


Update Operation

You can see that in the below-given relation table CustomerName= 'Apple' is updated
from Inactive to Active.

Delete Operation

To specify deletion, a condition on the attributes of the relation selects the tuple to be
deleted.

In the above-given example, CustomerName= "Apple" is deleted from the table.

The Delete operation could violate referential integrity if the tuple which is deleted is
referenced by foreign keys from other tuples in the same database.

Select Operation

In the above-given example, CustomerName="Amazon" is selected

Best Practices for creating a Relational Model

• Data need to be represented as a collection of relations


• Each relation should be depicted clearly in the table
• Rows should contain data about instances of an entity
• Columns must contain data about attributes of the entity
• Cells of the table should hold a single value
• Each column should be given a unique name
• No two rows can be identical
• The values of an attribute should be from the same domain

Relation Data Model 7


Advantages of using Relational model

• Simplicity: A relational data model is simpler than the hierarchical and network
model.
• Structural Independence: The relational database is only concerned with data
and not with a structure. This can improve the performance of the model.
• Easy to use: The relational model is easy as tables consisting of rows and
columns is quite natural and simple to understand
• Query capability: It makes possible for a high-level query language like SQL
to avoid complex database navigation.
• Data independence: The structure of a database can be changed without
having to change any application.
• Scalable: Regarding a number of records, or rows, and the number of fields, a
database should be enlarged to enhance its usability.
• It hides the physical storage details from the database developers and
database users

Disadvantages of using Relational model

• Few relational databases have limits on field lengths which can't be exceeded.
• Relational databases can sometimes become complex as the amount of data
grows, and the relations between pieces of data become more complicated.
• Complex relational database systems may lead to isolated databases where
the information cannot be shared from one system to another.

Summary

• The Relational database model represents the database as a collection of


relations (tables)
• Attribute, Tables, Tuple, Relation Schema, Degree, Cardinality, Column,
Relation instance, are some important components of Relational Model
• Relational Integrity constraints are referred to conditions which must be present
for a valid relation
• Domain constraints can be violated if an attribute value is not appearing in the
corresponding domain or it is not of the appropriate data type
• Insert, Select, Modify and Delete are operations performed in Relational Model
• The relational database is only concerned with data and not with a structure
which can improve the performance of the model
• Advantages of relational model is simplicity, structural independence, ease of
use, query capability, data independence, scalability.
• Few relational databases have limits on field lengths which can't be exceeded.

Relation Data Model 8

You might also like