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.
Operation of Union Operator
Operation:
* It displays all the tuples/records belonging to the first relation (left relation) or the second relation (right
relation) or both.
* It also eliminates duplicate tuples (tuples present in both relations appear once).
Operation of Intersect/ Intersection Operator
Operation:
* It displays all the tuples/records belonging to both relations. OR
* It displays all the tuples/records which are common from both relations.
Operation of Minus/ Set difference Operator
Operation:
* It displays all the tuples/records belonging to the first relation (left relation) but not in the second relation
(right relation).
What are the types of Functional Dependencies
Trivial FD:RHS is subset of LHS
Nontrivial FD: One of RHS attribute is not subset LHS.
Completely Non-Trivial FD: None of RHS attribute is subset of LHS.
Full Functional Dependency: In a relation, the attribute B is fully functional dependent on A if B is functionally dependent on A, but not on any proper subset of A.
Partial Functional Dependency:
Partial Functional Dependency
In a relation, the attribute B is partial functional dependent on A if B is functionally dependent on
A as well as on any proper subset of A.
Transitive Functional Dependency:
Transitive Functional Dependency
In a relation, if attribute(s) A →B and B →C, then A →C (means C is transitively depends on A via B).
What are armstrong’s axioms
Armstrong’s axioms are a set of rules used to infer (derive) all the functional dependencies on a relational database.
What are armstrong’s axioms
Armstrong’s axioms are a set of rules used to infer (derive) all the functional dependencies on a relational database.
What are armstrong’s axioms
Armstrong’s axioms are a set of rules used to infer (derive) all the functional dependencies on a relational database.
Whats a closure
Given a set of attributes α, the closure of α under F is the set of attributes that are functionally determined by α under F.
Use of the closure is:
Use of Closure of Attributes:
* To identify the additional FDs.
* To identify the keys
* To identify the equivalence of FD
* To identify the standard form, canonical form or irreducible set of FD.
What is Decomposition?
Decomposition is the process of breaking down given relation into two or
more relations.
Types of Decomposition?
Types of decomposition
* Lossy decomposition
* Lossless decomposition (non-loss decomposition)
Properties of Decomposition?
Properties of Decomposition:
* Lossless (Mandatory)
* Dependency Preserving (Optional)
What is Lossy Decomposition?
Lossy decomposition
* The decomposition of relation R into R1 and R2
is lossy when the natural join of R1 and R2 does
not yield the same relation as in R.
* This is also referred as lossy-join decomposition.