Chapter 8 Flashcards
_________ is the basic set of operations for the relational model.
Relational algebra
T/F: Relational operations enable a user to specify basic retrieval requests (or queries.)
True.
T/F: The result of a relational operation is a new relation, which may have been formed from one or more input relations.
True.
“The result of a relational operation is a new relation, which may have been formed from one or more input
relations.”
This property makes the algebra ______.
“closed” (all objects in relational algebra are relations)
T/F: Not all objects in relational algebra are relations.
F, all objects in relational algebra are relations.
T/F: The new relations produced by the algebra operations can be further manipulated using operations of the same algebra.
True.
A sequence of relational algebra operations forms a ______________.
relational algebra expression
T/F: The result of a relational algebra expression is also a relation that represents the result of a database query (or retrieval request.)
True.
Relational Algebra consists of several groups of operations…
1.Unary Relational Operations, includes:
SELECT
PROJECT
RENAME
What are their symbols?
σ (sigma), π (pi), ρ (rho)
Relational Algebra consists of several groups of operations…
- Relational Algebra Operations From Set Theory
Which include?
UNION , INTERSECTION, DIFFERENCE (or MINUS, – ), CARTESIAN PRODUCT ( x ).
Relational Algebra consists of several groups of operations…
- Binary Relational Operations
Which include?
JOIN (several variations of JOIN exist), DIVISION.
Relational Algebra consists of several groups of operations…
- Additional Relational Operations
Which include?
OUTER JOINS, OUTER UNION, AGGREGATE FUNCTIONS.
In general, the select operation is denoted by:
σ <selection>(R)</selection>
Write the query statement using algebra operations:
Select the EMPLOYEE tuples whose department number is 4.
σ DNO = 4 (EMPLOYEE)
Write the query statement using algebra operations:
Select the employee tuples whose salary is greater than $30,000.
σ SALARY > 30,000 (EMPLOYEE)
T/F: The number of tuples in the result of a SELECT is less than (or equal to) the number of tuples in the input relation R.
True.
T/F: SELECT σ is commutative.
true. ex:
σ <condition1>(σ < condition2> (R)) = σ <condition2> (σ < condition1> (R))</condition2></condition1>
T/F: The SELECT operation σ <selection>(R) produces a relation S that has the same schema (same attributes) as R.</selection>
true.
Write the sql equivalent of the following:
σ SALARY > 30,000 (EMPLOYEE)
SELCT * FROM Employee WHERE Salary > 30000;
Name the algebra operation:
_________ operation keeps certain columns (attributes) from a relation and discards the other columns.
PROJECT
Name the algebra operation:
________ creates a vertical partitioning.
PROJECT.
(In other words, The list of specified columns (attributes) is kept in each tuple,
while the other attributes in each tuple are discarded.)
Write the query for the following using relational operations:
List each employee’s first and last name and salary.
π LNAME, FNAME, SALARY (EMPLOYEE)
The general form of the project operation is:
π<attribute>(R)</attribute>
The project operation removes any __________ tuples.
duplicate
T/F: the result of the project operation
must be a set of tuples.
True, a set of tuples that do not include duplicates as Mathematical sets do not allow duplicate elements.
T/F: The number of tuples in the result of projection is always less or equal to the number of tuples in R.
True.
T/F: If the list of attributes includes a key of R, then the
number of tuples in the result of PROJECT is EQUAL to the number of tuples in R.
True.
T/F: PROJECT is commutative.
False, PROJECT is NOT commutative.
π <list1> (π <list2> (R) ) = π <list1> (R) as long as <list2> contains the attributes in <list1>.</list1></list2></list1></list2></list1>
Find the results of the following:
σ(Dno=4 AND Salary>25000) OR (Dno=5 AND Salary>30000)(EMPLOYEE)
Find the result of the following:
πLname, Fname, Salary(EMPLOYEE).
Write the algebra operation equivalence to the following sql statement:
SELECT DISTINCT Lname, Fname, Salary
FROM Employee;
πLname, Fname, Salary(EMPLOYEE).
T/F: We can apply one operation at a time and create
intermediate result relations, instead of writing a single relational algebra expression.
True.
Write a single relational algebra expression for the following:
retrieve the first name, last name, and salary of all employees who work in department number 5.
π Fname, Lname, Salary (σ DNO = 5 (EMPLOYEE))