DSE 310 - Topic 2
DSE 310 - Topic 2
DSE 310
Relational Algebra and Relational
Calculus
Lecture Objectives:
● Understand relation algebra and relational calculus
● Understand different operators and their formal definitions
Topics:
● Basic operations ● Other operations
○ Select ○ Intersection
○ Project ○ Join
○ Union ○ Aggregate
○ Set Difference ○ Division
○ Cartesian product
○ Rename
Relational algebra is procedural but calculus is non procedural
(In NPTEL both are mentioned as non-procedural)
Few Points on Relational Algebra
● Procedural and algebra based
● Proposed by Edgar Codd in 1970s
● Relations are set of tuples defined by a list of attributes.
● Input to each query (relational algebra expression) is a table or set of tables
● Query output is a table
● All data in the output table appears in one of the input tables.
● Procedural language
● Not turing equivalent language
○ Everything that can be computed may not be computed by this language
Select operation -> Selection of rows/tuples
Project operation -> Selection of attributes/columns
The output is a set of all tuples such that for each tuple t, P(t) is true.
Where t is called tuple variable and t[A] is the value of tuple t on attribute A.