DBMS Relational Algebra Flashcards
Whats Relational Algebra
Relational algebra is a procedural query language. It gives a step by step process to obtain the result of the query. It uses operators to perform queries.
What are Binary and Unary Operators?
Unary:
Selection
Projection
Rename
Binary:
Joins
Cross-product
Set operators
Division
What are Binary and Unary Operators?
Unary:
Selection
Projection
Rename
Binary:
Joins
Cross-product
Set operators
Division
Explain Projection Operator
Selects specified attributes of a relation.
* It removes duplicate tuples (records) from the result.
Explain Projection Operator
Selects specified attributes of a relation.
* It removes duplicate tuples (records) from the result.
Explain Selection Operator
Selects tuples from a relation that satisfy a given
condition.
Explain Selection Operator
Selects tuples from a relation that satisfy a given
condition.
What comes first in the mixture of selection and proejection operators!? f
first write the projection opertor and then in bracket write the selection operator
Write abt the operation of Cartesian or Cross Product
It will multiply each tuples of Relation-1 to each tuples of Relation-2.
* Attributes of Resultant Relation = Attributes of R1 + Attributes of R2
* Tuples of Resultant Relation = Tuples of R1 * Tuples of R2
Write abt the operation of Natural/Inner Join?
Natural join will retrieve consistent data from multiple relations.
* It combines records from different relations that satisfy a given condition.
To perform a Natural Join there must be one common attribute (column) between two relations.
Steps for performing Natural/Inner Join are?
Step – 1 It performs Cartesian Product
Step – 2 Then it deletes inconsistent tuples
Step – 3 Then it removes an attribute from duplicate attributes
Whats Outer join?
Outer Join
* In natural join some records are missing, if we want that missing records than we have to use outer join.
To perform a Outer Join there must be one common attribute (column) between two relations.
Operation of Left Outer Join?
Operation:
* Display all the tuples of the left relation even through there is no matching tuple in the right relation.
* For such kind of tuples having no matching, the attributes of right relation will be padded with NULL in resultant relation.
Operation of Right Outer Join
Operation:
* Display all the tuples of right relation even through there is no matching tuple in the left relation.
* For such kind of tuples having no matching, the attributes of left relation will be padded with NULL in resultant relation.
Operation of Full Outer Join
Operation:
* Display all the tuples of both of the relations. It also pads null values whenever required. (Left outer join + Right outer join)
* For such kind of tuples having no matching, it will be padded with NULL in resultant relation.