Professional Documents
Culture Documents
Presented By:-
Dr. Sanjeev Sharma
Introduction
• Data: Known facts that can be recorded and have an
implicit meaning.
• E.g.
account : information about accounts
depositor : which customer owns which account
customer : information about customers
Integrity Constraints
• These are the rules or constraints applied to the database to
keep data stable, accurate or consistent. To keep database
consistent we have to follow some rules known as integrity
rules or integrity constraints.
– Entity Integrity Rule (Integrity Rule 1)
– Referential Integrity Rule (Integrity Rule 2)
– Domain Constraints
– Key Constraints
Entity Integrity Rule
• Primary key or a part of it in any relation cannot be null.
Suppose A be the attribute in relation R which is taken as
primary key then A must not be null.
Referential Integrity Rule
• A foreign key can be either null or it can have only those
values which are present in the primary key with which it is
related.
• Thus, both the operands and the results are relations; hence the
output from one operation can become the input to another
operation.
• This allows expressions to be nested in the relational algebra.
This property is called closure. Relational algebra is an
abstract language, which means that the queries formulated in
relational algebra are not intended to be executed on a
computer.
Relational Algebra Operations
• Operations may be unary or binary.
• The functional operations in the relational algebra are :
– Select
– Project
– Union
– Set difference
– Cartesian product
– Rename
– Intersection
– Division
– Join
– Natural Join
Selection Operation
• The selection operation works on a single relation R and
defines a relation that contains only those tuples of R that
satisfy the specified condition (Predicate).