You are on page 1of 4

ITIMNT – SESSION 4

RELATIONAL MODEL
RELATIONAL MODEL CONCEPTS
 Relational data model is the primary In the Relational model the, relations are saved
data model, which is used widely in the table format. It is stored along with its
around the world for data storage entities. A TABLE has two properties rows and
and processing. This model is simple columns. Rows represent records and columns
and it has all the properties and represent attributes.
capabilities required to process data
with storage efficiency.
 The relational model represents the
database as a collection of relations.
A relation is nothing but a table of
values. Every row in the table
represents a collection of related
data values. These rows in the table  TABLE: Airlines (also called RELATION)
denote a real-world entity or
relationship.  TUPLE - a single row of a table, which contains
a single record.
CODD’S 12 RULES

 E.F Codd was a Computer Scientist who


invented the Relational model for
Database management. Based on
relational model, the Relational
database was created.
 Codd proposed 13 rules popularly
ATTRIBUTE- Each column in a Table. Attributes
known as Codd's 12 rules to test
are the properties which define a relation.
DBMS's concept against his relational
model.
 Codd's rule actually define what quality
a DBMS requires in order to become a
Relational Database Management
System(RDBMS).

RELATIONAL MODEL CONCEPTS

1. Table / Relation
2. Tuple / Record  ATTRIBUTE DOMAIN. A domain is a set of
3. Attribute / Column / Field permitted values for an attribute in table. An
4. Relation key attribute cannot accept values that are outside
5. Attribute domain of their domains.
6. Relation Schema
7. Relation instance
 Non Key

 RELATION SCHEMA - represents the name of SUPER KEY


the relation with its attributes.  Super Key is defined as a set of attributes
within a table that can uni
quely identify each record within a table.
 Super Key is a superset of Candidate key.
 TABLE: EMPLOYEE

 RELATION INSTANCE - is a finite set of tuples in


the RDBMS system. Relation instances never
have duplicate tuples.
 TABLE: EMPLOYEE
 EM_ID, EM_PhilHealthNum, EM_phoneNum,
EM_Bday, {EM_ID, EM_name}, {EM_ID,
EM_PhilHealthNum}, {EM_PhilHealthNum,
EM_name}

 RELATION INSTANCE OF SCHEMA AIRLINE IS 5

 RELATION KEY - Every row has one, two or


multiple attributes. It is an attribute which can
uniquely identify a particular tuple(row) in a
relation(table).
CANDIDATE KEY
 Candidate key is a minimal super key with no
redundant attributes. It
is a super key with no redundant attributes
 EM_ID, EM_PhilHealthNum

KEYS
 Key plays an important role in relational
database; it is used for identifying unique rows
from table. It also establishes relationship
among tables. PRIMARY KEY
 A Primary key is a column or set of columns in
TYPES OF KEYS a table that uniquely
 Super Key identifies tuples (rows) in that table. It is
 Candidate Key selected from a set of
 Primary Key candidate keys. This is done by database admin
 Alternative / Alternate Key or database designer.
 Composite Key EM_ID or EM_PhilHealthNum can be chosen as
 Foreign Key a primary
KEY CONSTRAINTS
 An attribute that can uniquely identify a tuple
in a relation is called the key of the table.
FOREIGN KEY  The value of the attribute for different tuples
 Foreign Key – Foreign keys are the columns of in the relation has to be unique.
a table that points to  Key constraints force that:
the primary key of another table.  In a relation with a key attribute, no two
 They act as a cross-reference between tables tuples can have identical values for key
 AR_ID is the primary key of the AIRLINES attributes.
Relation  A key attribute can not have NULL values.

OTHER KEYS
 Alternate Key – Out of all candidate keys, only
one gets selected as primary key, remaining keys
are known as alternate or secondary keys.
 Composite Key – A key that consists of more DOMAIN CONSTRAINTS
than one attribute to uniquely identify rows  Domain constraints can be violated if an
(also known as records & tuples) in a table is attribute value is not appearing in the
called composite key. corresponding domain or it is not of the
 Non – Key - attributes are the attributes or appropriate data type.
fields of a table, other than candidate key  Domain constraints specify that within each
attributes/fields in a table. tuple, and the value of each attribute must be
unique.
 This is specified as data types which include
CONSTRAINTS standard data types integers, real numbers,
characters, Booleans, variable length strings,
CONSTRAINTS etc.
 Every relation has some conditions that must
hold for it to be a valid relation. These
conditions are called Relational Integrity
Constraints.

There are three main integrity constraints

 Key constraints
 Domain constraints
 Referential integrity constraints
REFERENTIAL INTEGRITY CONSTRAINTS
 Referential integrity constraints is base on the
concept of Foreign Keys.
 A foreign key is an important attribute of a
relation which should be referred to in other
relationships.
 Referential integrity constraint state happens
where relation refers to a key attribute of a
different or same relation. However, that key
element must exist in the table.

QUERY LANGUAGE
 Relational database systems are expected to
be
equipped with a query language that can assist
its users to query the database instances.

There are two kinds of query languages


 Relational Algebra – Procedural
 Relational Calculus – Non Procedural

RELATIONAL ALGEBRA

 Relational Algebra is a procedural query


language used to query the database tables to
access data in different ways.

 In relational algebra, input is a relation(table


from which data has to be accessed) and output
is also a relation(a temporary table holding the
data asked for by the user).

You might also like