0% found this document useful (0 votes)
4 views20 pages

Understanding Relational Database Models

The document discusses key concepts in relational databases including relations, attributes, tuples, domains, keys, and integrity constraints. It defines relations as tables with rows and columns. Attributes are the columns of a relation. Tuples are the rows. A domain defines the set of allowable values for an attribute. Keys such as superkeys, candidate keys and primary keys uniquely identify tuples. Integrity constraints like entity and referential integrity ensure data accuracy. Views allow customized access to data through relational operations on base relations.

Uploaded by

Ahmad Naeem
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views20 pages

Understanding Relational Database Models

The document discusses key concepts in relational databases including relations, attributes, tuples, domains, keys, and integrity constraints. It defines relations as tables with rows and columns. Attributes are the columns of a relation. Tuples are the rows. A domain defines the set of allowable values for an attribute. Keys such as superkeys, candidate keys and primary keys uniquely identify tuples. Integrity constraints like entity and referential integrity ensure data accuracy. Views allow customized access to data through relational operations on base relations.

Uploaded by

Ahmad Naeem
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Chapter No.

The Relation Model

Naeem Aslam 1
Relational Terminology
Relation:

“A relation is a table with columns and


rows.”

An RDBMS requires only that the database be


perceived by the user as tables. This perception
applies only to the logical structure of the
database (Conceptual and External level). It
does not apply to the physical structure of the
database.

Naeem Aslam 2
Relational Terminology-I
Attribute:
“An attribute is a named column of a relation.”
In the relational model, relations are used to hold
information about the object. A relation is represented as
two dimensional table in which the rows of the table
correspond to the individual records and table columns
correspond to the attributes.

Attributes can appear in any order and the relation will still
be the same relation and therefore convey the same
meaning.

Naeem Aslam 3
Relational Terminology-II
Domain:
“A domain is the set of allowable values
for one or more attributes.”
Attribute: branchNo
Domain Name: Branch Numbers
Meaning: The set of all possible branch
numbers
Domain Definition: character: Size 4, range
B001-B999
Naeem Aslam 4
Relational Terminology-III
Tuple:
“A tuple is a row of a relation.”
Tuples can appear in any order and relation
will still be the same relation and therefore
convey the same meaning.

The tuples are called the extension or state


of a relation, which changes over time.
Naeem Aslam 5
Relational Terminology-IV
Degree:
“The degree of a relation is the number of
attributes it contains.”
A relation with only one attribute would have
degree one and be called a unary relation or one
tuple.
A relation with two attributes would have degree
two and be called a binary relation.
The degree of a relation is a property of the
intension of the relation.

Naeem Aslam 6
Relational Terminology-V
Cardinality:
“The cardinality of a relation is the number of
tuples it contains.”
The number of tuples is called the cardinality of the
relation and this changes as the tuple added or
deleted.
The cardinality is a property of extension of the
relation and is determined from the particular
instance of the relation at any given moment.

Naeem Aslam 7
Relational Terminology-VI
Relational database:

A relational database consists of relations


that are appropriately structured. We refer to
this appropriateness as normalization.

Naeem Aslam 8
Alternative Terminology
Alternative terminology for relational model
terms.

Formal Terms Alternative1 Alternative2

Relation Table File


Tuple Row Record
Attribute Column Field
Naeem Aslam 9
Properties of Relations
•The relation has a name that is distinct from all
other relation names in the relational schema
•Each cell of the relation contains exactly one
atomic or single value
•Each attribute has a distinct name
•The values of an attribute are all from same
domain
•Each tuple is distinct there are no duplicate tuples
•The order of attribute has no significance
•The order of tuples has no significance
Naeem Aslam 10
Relational Keys
Purpose:

There are no duplicate tuples within a


relation. Therefore we need to be able to
identify one or more attributes (called
relational keys) that uniquely identifies each
tuple in a relation.

Naeem Aslam 11
Superkey

An attribute or set of attributes that uniquely


identifies a tuple within a relation.

Naeem Aslam 12
Candidate Key
A superkey such that no proper subset is a
superkey with in the relation.

There may be several candidate keys for a


relation. When key consists of more than
one attribute we call it a composite key.

Naeem Aslam 13
Primary Key
The candidate key that is selected to identify
tuples uniquely within the relation.

The candidate keys that are not selected to


be the primary key are called alternate keys.

Naeem Aslam 14
Foreign Key
When an attribute appear in more than one
relation, its appearance usually represents a
relationship between tuples of the two
relations.

Naeem Aslam 15
Relational Integrity
A data model has two parts:
Manipulative Part:
Defining the types of operation that are
allowed on the data.

Set of Integrity Rules:


Which ensure that the data is accurate.

Naeem Aslam 16
Relational Integrity-I
Two important integrity rules which are constraints
or restrictions that apply to all instances of the
database.
A Base Relation as a relation that corresponds to
an entity in the conceptual schema.
1)Entity Integrity
In base relation no attribute of a primary key can
be null
2) Referential Integrity
Naeem Aslam 17
Relational Integrity-II
Enterprise Constraints:

Additional rules specified by the users or


database administrators of a database.

Naeem Aslam 18
View
The dynamic result of one or more relational
operations operating on the base relations to
produce another relation. A view is a virtual
relation that does not necessarily exist in the
database but can be produced upon request
by a particular user, at time of request.

Naeem Aslam 19
Purpose of Views
A powerful and flexible security by hiding the
part of the database from certain users.
It permits users to access data in a way that
is customized to their needs, so that the
same data can be seen by different users in
different ways at the same time.
It can simplify complex operations through
joins.
Naeem Aslam 20

You might also like