3.9 Relational Algebra Flashcards
What is the equivalent of a relational algebra expression?
An SQL query defining a single result table.
- What operation does the symbol
σ
represent in relational algebra? - What is the operation written as?
Select
Greek Letter: sigma
- What operation does the symbol
π
represent in relational algebra? - What is the operation written as?
Project
Greek Letter: Pi
- What operation does the symbol
×
represent in relational algebra? - What is the operation written as?
Product
- What operation does the symbol
⨝
represent in relational algebra? - What is the operation written as?
Join
- What operation does the symbol
∪
represent in relational algebra? - What is the operation written as?
Union
- What operation does the symbol
∩
represent in relational algebra? - What is the operation written as?
Intersect
- What operation does the symbol
−
represent in relational algebra? - What is the operation written as?
Difference
- What operation does the symbol
ρ
represent in relational algebra? - What is the operation written as?
Rename
Greek Letter: rho
- What operation does the symbol
γ
represent in relational algebra? - What si the operation written as?
Aggregate
Greek Letter: gamma
Fill in the blank: The symbol σ
corresponds to the operation _______ in relational algebra.
Select
Fill in the blank: The symbol π
corresponds to the operation _______ in relational algebra.
Project
Fill in the blank: The symbol ρ
corresponds to the operation _______ in relational algebra.
Rename
Fill in the blank: The symbol γ
corresponds to the operation _______ in relational algebra.
Aggregate
What is the operation equivalent to SQL SELECT
?
SELECT * FROM Table WHERE expression
This operation retrieves rows from a table that meet a specified condition.
What is the relational algebra operation equivalent to SQL PROJECT
?
SELECT Column1, Column2
This operation selects specific columns from a table.
What is the relational algebra operation equivalent to SQL PRODUCT
?
SELECT * FROM Table1 CROSS JOIN Table2
This operation combines all rows from Table1 with all rows from Table2.
What is the relational algebra operation equivalent to SQL JOIN
?
SELECT * FROM Table1 INNER JOIN Table2 ON expression
This operation combines rows from two tables based on a related column.
What is the relational algebra operation equivalent to SQL UNION
?
SELECT * FROM Table1 UNION SELECT * FROM Table2
This operation combines the results of two queries, removing duplicates.
What is the relational algebra operation equivalent to SQL INTERSECT
?
SELECT * FROM Table1 INTERSECT SELECT * FROM Table2
This operation retrieves rows that are common to both tables.
What is the relational algebra operation equivalent to SQL DIFFERENCE
?
SELECT * FROM Table1 MINUS SELECT * FROM Table2
This operation retrieves rows from Table1 that are not in Table2.
What is the relational algebra operation equivalent to SQL RENAME
?
No direct SQL syntax; typically done by aliasing
This operation allows renaming tables and columns for clarity.
What is the relational algebra operation equivalent to SQL AGGREGATE
?
SELECT GroupColumn, Function(Column) FROM Table GROUP BY GroupColumn
aggregate functions is typically expressed using the Group By operation along with an Aggregation operation
Set operations in MYSQL
What operations are part of the SQL standard?
- The
UNION
,INTERSECT
, andMINUS
keywords are part of the SQL standard. - MySQL supports
UNION
but notINTERSECT
andMINUS
.
Set operations in MYSQL
A ∩ B
What is this implememented as in SQL
Set operations in MYSQL
A - B
What is this implememented as in SQL
SELECT A1, A2 FROM A LEFT JOIN B ON (A1 = B1 AND A2 = B2) WHERE B1 IS NULL;
What are equivalent expressions in relational algebra?
Relational algebra expressions that operate on the same tables and yield the same result.
What is the primary role of a query optimizer?
To convert an SQL query into a sequence of lower-level database actions known as a query execution plan.
List the steps involved in the query optimization process.
Convert, generate, est, determine, convert
- Convert SQL query into a relational algebra expression
- Generate equivalent expressions
- Estimate the cost associated with each operation
- Determine the optimal expression with the lowest total cost
- Convert the optimal expression into a query execution plan
What does cost estimation in query optimization refer to?
A numeric estimate of the processing time required, combining storage media access and computation time.
The order of operations does not change the _______ of relational algebra expressions.
[result]
How does changing the order of operations alter the result of an expression.
The order of operations does not change the result of relational algebra expressions.