Short Notes: Relational Model | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE) PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


Relational Algebra: Relational model is completely based on relational algebra. It 
consists of a collection of operators that operate on relations. Its main objective is 
data retrieval. It is more operational and very much useful to represent execution 
plans, while relational calculus is non-operational and declarative. Here, declarative 
means user define queries in terms of what they want, not in terms of how they 
compute it.
Relational Query Languages
Used for data manipulation and data retrieval. Relational model support simple yet 
powerful query languages. To understand SQL, we need good understanding of two 
relational query languages (i.e., relational algebra and relational calculus).
Basic Operation In Relational Algebra
The operations in relational algebra are classified as follows.
Selection (a): The select operation selects tuples/rows that satisfy a given 
predicate or condition. We use (a) to denote selection. The predicate/condition 
appears as a subscript to o.
Projection (tt): It selects only required/specified columns/attributes from a given 
relation/table. Projection operator eliminates duplicates (i.e., duplicate rows from 
the result relation).
Union (u): It forms a relation from rows/tuples which are appearing in either or 
both of the specified relations. For a union operation R u S to be valid, below two 
conditions must be satisfied. •
• The relations Rand S must be of the same entity i.e., they must have the same 
number of attributes.
• The domains, of the i th attribute of R and i th attribute of S must be the same, 
for all i.
Page 2


Relational Algebra: Relational model is completely based on relational algebra. It 
consists of a collection of operators that operate on relations. Its main objective is 
data retrieval. It is more operational and very much useful to represent execution 
plans, while relational calculus is non-operational and declarative. Here, declarative 
means user define queries in terms of what they want, not in terms of how they 
compute it.
Relational Query Languages
Used for data manipulation and data retrieval. Relational model support simple yet 
powerful query languages. To understand SQL, we need good understanding of two 
relational query languages (i.e., relational algebra and relational calculus).
Basic Operation In Relational Algebra
The operations in relational algebra are classified as follows.
Selection (a): The select operation selects tuples/rows that satisfy a given 
predicate or condition. We use (a) to denote selection. The predicate/condition 
appears as a subscript to o.
Projection (tt): It selects only required/specified columns/attributes from a given 
relation/table. Projection operator eliminates duplicates (i.e., duplicate rows from 
the result relation).
Union (u): It forms a relation from rows/tuples which are appearing in either or 
both of the specified relations. For a union operation R u S to be valid, below two 
conditions must be satisfied. •
• The relations Rand S must be of the same entity i.e., they must have the same 
number of attributes.
• The domains, of the i th attribute of R and i th attribute of S must be the same, 
for all i.
Intersection (fl): It forms a relation of rows/ tuples which are present in both the 
relations R and S. Ensure that both relations are compatible for union and 
intersection operations.
Set Difference (-): It allows us to find tuples that are in one relation but are not in 
another. The expression R - S produces a relation containing those tuples in R but 
not in S.
Cross Product/Cartesian Product (x): Assume that we have n -i tuples in R and n2 
tuples in S. Then, there are n -i * n2 ways of choosing a pair of tuples; one tuple from 
each relation. So, there will be (ni * n2) tuples in result relation P if P = R x s.
So, we can say that Cross product between two relation relate each and every tuple 
of one relation to the other relation.
Natural Join(x): A NATURAL JOIN is a JOIN operation that creates an 
implicit join clause for you based on the common columns in the two tables being 
joined. Common columns are columns that have the same name in both tables.
Conditional Join(ixic): It is performed by obtaining the cross product on given 
tables and then followed by applying the condition C on the obtained result, it is 
similar to conditional join except the fact that condition can be applied for any 
attributes (not restricted to the common attributes).
Outer Join: it is further divided into three parts:
• Left Outer Join(x): Output the records of natural join plus the record of 
left table which fails to appear in natural join.
• Right Outer Join(xt): Output the records of natural join plus the record of 
right table which fails to appear in natural join.
• Full Outer Join(x): Output the records of natural join plus the record of 
left table as well as right table which fails to appear in natural join.
Rename Operator(p): It is used to rename the instance of a relation, it can also be 
used to rename the attributes of the given relation, also, the changes are not 
reflected to the original database.
Division Operator(/):
• The relation returned by division operator will return those tuples from relation 
A which are associated to every B’s tuple.
• For R/S, Attributes of S should be proper subset of R .
Cardinalities: For a relation R with n distinct tuples and relation S with m distinct 
tuples-
Operation Cardinality
RxS n*m tuples
RxS 0 to nm tuples
RtxicS 0 to nm tuples
RxS n to nm tuples
RxS m to nm tuples
RxS max(m,n) to mn tuples
RuS max(m,n) to m+n tuples
Read More
90 docs

Top Courses for Computer Science Engineering (CSE)

Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

MCQs

,

shortcuts and tricks

,

Extra Questions

,

ppt

,

study material

,

Free

,

Semester Notes

,

video lectures

,

Important questions

,

practice quizzes

,

Exam

,

Short Notes: Relational Model | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

Objective type Questions

,

Summary

,

pdf

,

Viva Questions

,

Sample Paper

,

Short Notes: Relational Model | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

mock tests for examination

,

past year papers

,

Short Notes: Relational Model | Short Notes for Computer Science Engineering - Computer Science Engineering (CSE)

,

Previous Year Questions with Solutions

;