DatabasesLesson 3 of 5 in the course Relational model and SQL

Relational Algebra: Core Operators, Query Optimization, and SQL Semantics

5 flashcards · 5 quiz questions · 5 match pairs · 5 fill-in sentences · English

Lesson progress
0 / 5

Your progress is kept in this browser only.Sign up to save it

Summary

Relational algebra provides a precise way to describe transformations of tabular data. It is a theoretical foundation for relational databases and helps explain how database queries can be combined and optimized.

A relation of arity nn is a set of nn-tuples. In a table, each tuple corresponds to a row, and each position in a tuple corresponds to an attribute or column. The arity is the number of attributes; the number of tuples is the number of rows.

All flashcards

What is a relation?
A set of tuples with a defined header. Each tuple has the same attributes, and values in each attribute come from an appropriate domain.
What is the arity of a relation?
The number of attributes in each tuple, corresponding to the number of columns in a table.
What does union compatibility mean?
The relations have the same set of attributes, with corresponding attributes compatible so their tuples can be compared and combined.
What is a Cartesian product?
A binary operation that combines every tuple in one relation with every tuple in another, producing flattened tuples with attributes from both.
What is the cardinality of a Cartesian product?
The product of the input cardinalities: ∣R×S∣=∣R∣×∣S∣|R \times S|=|R|\times|S|.

Quiz questions

  1. In classical relational algebra, what happens to duplicate tuples produced by projection?Answer: They are eliminated because the result is a set.
  2. What does a left outer join preserve when no matching tuple exists on the right?Answer: The unmatched left tuple, with null-like values for right-side attributes.
  3. What does transitive closure of a binary relation represent?Answer: Pairs connected by a path of one or more links.
  4. Why might a query optimizer push a selection closer to an input relation?Answer: Filtering earlier can reduce the size of intermediate results.
  5. How do SQL query results commonly treat duplicate rows by default?Answer: They may retain duplicates, following bag rather than set semantics.

Based on the Wikipedia article Relational algebra, licensed CC BY-SA 4.0. Adapted into a summary, flashcards and quizzes.

All Databases lessons