Professional Documents
Culture Documents
Session 4 Reviewer
Session 4 Reviewer
1.Table / Relation
RELATIONAL MODELS
2.Tuple / Record
3.Attribute / Column / Field
Relational data model is the primary data
4.Relation Key
model, which is used widely around the
world for data storage and processing. 5.Attribute Domain
6.Relation Schema
Relational model represents the database 7.Relation Instance
as a collection of relations. A relation is
nothing but a table of values. Every row TABLE
in the table represents a collection of
related data values. These rows in the A table has two properties rows and
table denote a real-world entity or columns. Rows represent records and
relationship. columns represent attributes.
CODD’S 12 RULES
ATTRIBUTE
Each column in a Table. Attributes are the
properties which define a relation.
ATTRIBUTE DOMAIN
A domain is a set of permitted values for an
attribute in table. An attribute cannot accept
values that are outside of their domains.
KEYS
Key plays an important role in relational
database; it is used for identifying unique
rows from table. It also establishes
relationship among tables.
RELATIONAL SCHEMA
TYPES OF KEYS
Represents the name of the relation with its
attributes. • Super Key • Candidate Key •
Primary Key • Alternative /
Alternate Key • Composite Key •
Foreign Key • Non-Key
KEY CONSTRAINTS
An attribute that can uniquely identify a
tuple in a relation is called the key of the
table.
The value of the attribute for different tuples
Foreign Key – Foreign keys are the in the relation has to be unique.
columns of a table that points to the
primary key of another table.
AR_ID is the primary key of the AIRLINES
Relation
DOMAIN CONSTRAINTS
CONSTRAINTS
Relational Integrity Constraints - Every
relation has some conditions that must hold
for it to be a valid relation.
REFERENTIAL INTEGRITY
CONSTRAINTS
QUERY LANGUAGE
• The primary operations that we can
• Relational database systems are perform using relational algebra are: a)
expected to be equipped with a query Select
language that can assist its users to b) Project
query the database instances. c) Union
• There are two kinds of query d) Set Intersection
languages e) Set Different
a) Relational Algebra – Procedural
f) Cartesian product
b) Relational Calculus – Non
g) Rename
Procedural
RELATIONAL ALGEBRA
SELECT
• Relational Algebra is a procedural query
language used to query the database • Select Operator is denoted by sigma (σ)
tables to access data in different ways. and it is used to find the tuples (or rows)
• In relational algebra, input is a relation in a relation (or table) which satisfy the
(table from which data has to be given condition.
accessed) and output is also a relation • Notation: σ Condition (Relation/Table
(a temporary table holding the data name)
asked for by the user).
UNION
PROJECT
SET INTERSECTION
SET DIFFERENT
RELATIONAL CALCULUS
Where
a) T is the resulting tuples
b) P(T) is the condition used to
fetch T.