0% found this document useful (0 votes)
96 views4 pages

Relational Model

The relational model represents data as mathematical relations or tables consisting of rows and columns. Data is stored in tables where each row represents a tuple and each column represents an attribute. Relations have a schema that defines the relation name, attributes, and domains. Relations can be related through keys and referential integrity constraints to ensure consistency across tables.

Uploaded by

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

Relational Model

The relational model represents data as mathematical relations or tables consisting of rows and columns. Data is stored in tables where each row represents a tuple and each column represents an attribute. Relations have a schema that defines the relation name, attributes, and domains. Relations can be related through keys and referential integrity constraints to ensure consistency across tables.

Uploaded by

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

Relational Model:

The relational Model of Data is based on the concept of a Relation. In Relational model, data are stored
in the table format. It is a primary data model, which is used widely around the world for commercial
data storage and processing applications.  This model is simple but it provides powerful way to process,
represent and store data with efficiency. It also supports complex query. The relational model consists of
three major components:
1. The set of relations and set of domains that defines the way data can be represented (data
structure).
2. Integrity rules that define the procedure to protect the data (data integrity).
3. The operations that can be performed on data (data manipulation).

Basic Terminology used in Relational Model:


In a formal relational model, a row is called a tuple, a column header is called an attribute, and the table
is called a relation. The data type describing the type of values that can appear in each column is
represented by a domain of possible values.
Informal Terms Formal Terms
Data type of column Domain
Column Attribute
Row Tuple
Table Relation
Table Definition Schema of Relation

Domain:
A domain definition specifies the kind of data represented by the attribute. It specifies that within each
tuple, the value of each attribute must be an atomic value. By atomic, we mean that each value in the
domain is indivisible as far as the formal definition is concerned.
If D is the domain of an attribute A which takes its values then it is denoted by dom(A).

Tuple:
A single row of a table, which contains a single record for that relation, is called a tuple.

Attribute:
A column of a table, which describes the relation, is called an attribute. Each attribute is associated with a
domain.

Relation:
A relation is defined as a table of values. It can be thought as a set of rows. It can also be alternatively
though as a set of columns.
A relation can also be defined as a subset of the Cartesian product of a list of domains characterized by a
name.
If D1, D2, ……, Dn are n domains, then the relation R on these domains is mathematically defined as:
R ⊆ D1X D2 X ……… X Dn

Relation Schema:
A relation schema is used to describe a relation. It describes the relation name (table name), attributes,
and their names.
Relation instance:
A finite set of tuples in the relational database system represents relation instance. Relation instances do
not have duplicate tuples.
A relation schema or relation scheme R, denoted R (A1, A2, …., An), is made up of a relation name R
and a list of attributes A1, A2, .. . An

Cardinality of a relation:
The number of tuples in a relation determines its cardinality.

Degree of a relation:
The degree of the relation is the number of attributes n of its relation schema. Each column in the tuple is
called an attribute. The number of attributes in a relation determines its degree.
Example:

Here,
Relation: STUDENT is the relation name.
Attributes: Name, Ssn, Home_phone, Address, Office_phone, Age and Gpa are attributes.
Adding the data type of each attribute, the definition is sometimes written as:
STUDENT(Name:string, Ssn:string, Home_phone:string, Address:string, Office_Phone:string,
Age:integer, Gpa:real)
Domain: dom(Name)= Names; dom(Ssn)= Social_security_numbers; dom(HomePhone)=
USA_phone_numbers, etc. are domains the cossecponding attribute.
Tuple: All data entries are Tuples.

Relation Schema: STUDENT (Name, Ssn, Home_phone, Address, Office_Phone, Age, Gpa)
Relation Instance:
Cardinality: In this case, the relation has a cardinality of 5.
Degree: In this case, the relation has a degree of 7.

Characteristics of a Relation:
a) Ordering of tuples in a relation:
The tuples are not considered to be ordered, even though they appear to be in the tabular form. A
relation is defined as a set of tuples. Mathematically, the elements of a set have no order; hence
tuples in a particular relation have no particular order. Tuple ordering is not part of the relation.
b) Ordering of Values in a tuple and an Alternative definition of a relation:
The order of values of a tuple can be changed as long as the correspondence between attributes
and values is maintained. If we consider attributes in R (A1, A2, ..., An) then the values in
t=<v1,v2, ..., vn> should correspond the order of the attributes.
c) Values in a tuple:
All values are considered atomic (indivisible). A special null value is used to represent values that
are unknown or inapplicable to certain tuples.

Alternative definition of a relation:


A relation can be given as R= {A1, A2, .. . An} a set of attributes (instead of a list) and a relation state
r(R) is a finite set of mapping r={t1, t2, .., tm} , where each tuple ti is a mapping from R to D and D is
the union of the attribute domains D= dom(A1)  dom( A2) .. .dom( An).
According to the definition of tuple as a mapping, a tuple can be considered as a set of ( ) pairs, where
each pair gives the value of the mapping from attribute Ai to a value vi from dom(Ai)

Interpretation of a Relation:
The relation schema can be interpreted as a declaration or an assertion. Some relations may represent
facts about entities, whereas other relations may represent facts about relationships. For example a
relation STUDENT, represents facts about a student entity. However a relation MAJORS(Student_Ssn,
Department_code) asserts that a student majors in an academic discipline. A tuple in this relation relates a
student to the department in which the major is offered.

Relational Model Notation:


 A relation schema R of degree n is denoted by R(A1, A2, .. . An),
 The uppercase letters Q, R, S denote relation names
 The letters t, u, v denote tuples
 In general, the name of a relation schema such as STUDENT also includes the current set of
tuples in that relation, whereas STUDENT(Name, Ssn,…) refers to the relation schema only.
 An attribute A can be related to the relation name R to which it belongs by using the dot .
notation R.A, example: STUDENT.Name or STUDENT. Age
 All attribute names in a particular relation must be distinct.
 An n-tuple t in a relation r(R) is denoted t=< v1, v2, .., vn> where each value vi 1≤ i ≤ n is the
value corresponding to attribute Ai . This notation is called component values of tuples.
 Both t[Ai] or t. Ai( or t[i]) refer to the value vi in t for attribute Ai .
 Both t[Au, Av,…., Az] and t.( Au, Av,…., Az) , where, Au, Av,…., Az is a list of attributes
from R, refer to the subtuple of values < vu, vv,…., vz.> from t corresponding to the values of
the attributes specified in the list.
Relational Model Constraints:
In a relational database, there will be many relations and the tuples in these relations are usually related in
various ways. Therefore, there must be many restrictions on the actual values in a database, so as to keep
the database consistent. These constraints are derived from the application that the database represents.
Constraints on databases can generally be divided into three main categories:
1. Constraints that are inherent in the data model, called inherent model-based constraints or
implicit constraints. For example, that not 2 tuples should be identical are such constraints.
2. Constraints that are directly expressed in schema of the data model, by specifying them in the
DLL (data definition language); these are called schema-based constraints or explicit
constraints.
3. Constraints that cannot be directly expressed in the schemas of the data model and must be
enforced by the application program, these are called application-based or semantic constraints
or business rules.

Domain Constraints:
Domain constraints specify that within each tuple, the value of each attribute A must be an atomic value
from the domain dom(A). The data types associated with domains include standard numeric datatypes for
integers, real numbers, characters, strings, Booleans. Also are available dates, time, money , a subrange
of values from a data type, or an enumerated data type in which all valid values are explicitly listed.

Key Constraints:
In the formal relational model, a relation is defined as a set of tuples. And all elements in a must be
distinct. This is maintained by the key constraints.
Some different types of keys are:
 Super Key
 Composite Key
 Candidate Key
 Primary Key
 Secondary/Alternate Key
 Foreign Key

Entity integrity constraint:


The entity integrity constraint states that no primary key value can be NULL. This is because the primary
key is used to identify tuples.
Key constraints and entity integrity constraints are specified on individual relations.
Referential integrity Constraints:
Referential integrity constraints are specified between two relations and are used to maintain consistency
among tuples in the two relations.
Referential integrity constraint states that if a relation refers to a key attribute of a different or same
relation, then that key element must exist. Referential integrity constraints work on the concept of
Foreign Keys.
Relational Database:
Database structure in a relational model is called Relational Database and is simply a collection of one or
more relations, where each relation is represented by table with rows and columns. A Relational Database
Management System (RDBMS) is a suite of software programs that can be used for creating,
maintaining, modifying and manipulating a relational database. It can also be used to create the
applications that a user will require for interacting with the data stored with in the database.

You might also like