C170 - 1.4 Relational Algebra Flashcards
27 Questions
100 Views

C170 - 1.4 Relational Algebra Flashcards

Created by
@MatchlessAltoSaxophone

Questions and Answers

What is Relational algebra?

A set of mathematical principles that form the basis for manipulating relational table contents; the eight main functions are SELECT, PROJECT, JOIN, INTERSECT, UNION, DIFFERENCE, PRODUCT, and DIVIDE.

The degree of relational completeness can be defined by what?

The extent to which relational algebra is supported.

To be considered minimally relational, the DBMS must do what?

Support the key relational operators SELECT, PROJECT, and JOIN.

What is the difference between 'relation' and 'relvar'?

<p>A relation is the data that we see in our tables, while a relvar is a variable that holds a relation.</p> Signup and view all the answers

What does 'relvar' stand for?

<p>Short for relation variable, a container (variable) for holding relation data, not the relation itself.</p> Signup and view all the answers

A relvar has two parts. What are they?

<p>The heading and the body.</p> Signup and view all the answers

An unspecified relation is often assigned __________ and relvar is assigned __________.

<p>a lower-case letter (e.g., 'r'), upper-case letter (e.g., 'R')</p> Signup and view all the answers

What is the property of closure?

<p>A property of relational operators that permits the use of relational algebra operators on existing tables (relations) to produce new relations.</p> Signup and view all the answers

What does SELECT (RESTRICT) yield?

<p>A horizontal subset of rows, not limiting the attributes returned.</p> Signup and view all the answers

What does PROJECT yield?

<p>A vertical subset, all values for selected attributes.</p> Signup and view all the answers

PROJECT is denoted by?

<p>The Greek letter pi (π).</p> Signup and view all the answers

What is UNION in relational algebra?

<p>An operator used to merge (append) two tables into a new table, dropping duplicate rows.</p> Signup and view all the answers

What does union-compatible mean?

<p>Two or more tables that have the same number of columns and the corresponding columns have compatible domains.</p> Signup and view all the answers

UNION is denoted by?

<p>The symbol ∪.</p> Signup and view all the answers

What is INTERSECT in relational algebra?

<p>An operator used to yield only the rows that are common to two union-compatible tables.</p> Signup and view all the answers

INTERSECT is denoted by?

<p>The symbol ∩.</p> Signup and view all the answers

What is DIFFERENCE in relational algebra?

<p>An operator used to yield all rows from one table that are not found in another table.</p> Signup and view all the answers

What is PRODUCT in relational algebra?

<p>An operator used to yield all possible pairs of rows from two tables.</p> Signup and view all the answers

What is the symbol for PRODUCT?

<p>The multiplication symbol ×.</p> Signup and view all the answers

What is JOIN in relational algebra?

<p>A type of operator used to yield rows from two tables based on criteria.</p> Signup and view all the answers

What is a Natural Join?

<p>A relational operation that yields a new table composed of only the rows with common values in their common attribute(s).</p> Signup and view all the answers

Explain the 3-step process of Natural Join (JOIN).

<ol> <li>PRODUCT of the tables is created; 2. SELECT is performed on the output of Step 1 to yield only the rows for which the attributes are equal; 3. PROJECT is performed on the results of Step 2 to yield a single copy of each attribute.</li> </ol> Signup and view all the answers

In the 3-step process of Natural Join, what are the common columns created in step 2 referred to as?

<p>Join columns.</p> Signup and view all the answers

What are join columns?

<p>Columns that are used in the criteria of join operations.</p> Signup and view all the answers

JOIN is denoted by?

<p>The symbol ⨝.</p> Signup and view all the answers

In JOIN, if no match is made between the table rows, then the new table includes the unmatched row.

<p>False</p> Signup and view all the answers

The column on which the join was made occurs how many times in the new table?

<p>Only once.</p> Signup and view all the answers

Study Notes

Relational Algebra Overview

  • Relational algebra provides mathematical principles for manipulating relational table contents.
  • Eight main functions include: SELECT, PROJECT, JOIN, INTERSECT, UNION, DIFFERENCE, PRODUCT, and DIVIDE.

Relational Completeness

  • Defined by the extent to which relational algebra is supported by a Database Management System (DBMS).
  • Minimally relational DBMS must support key operators: SELECT, PROJECT, and JOIN.

Concepts of Relation and Relvar

  • A relation is the actual data seen in tables, while a relvar is a variable that holds the relation.
  • Relvar contains two parts: heading (names of attributes) and body (actual relation data).

Naming Conventions

  • An unspecified relation is typically assigned a lower-case letter (e.g., "r"), while a relvar is assigned an upper-case letter (e.g., "R").

Closure Property

  • Closure allows relational algebra operators to be applied to existing relations, yielding new relations.

Core Operators in Relational Algebra

  • SELECT (RESTRICT): Used to choose a subset of rows from a table; produces a horizontal subset without limiting attributes.
  • PROJECT: Selects a subset of columns; produces a vertical subset containing all values for selected attributes, denoted by the Greek letter pi (π).

Set Operations

  • UNION: Merges two tables into one while eliminating duplicate rows. Tables must be union-compatible, meaning they have the same number of columns with compatible domains; denoted by symbol ∪.
  • INTERSECT: Yields only the rows common to two union-compatible tables; denoted by symbol ∩.
  • DIFFERENCE: Produces rows from one table that aren’t found in another, requiring union compatibility.

Cartesian Product

  • PRODUCT: Yields all possible pairs of rows from two tables, also known as the Cartesian product, denoted by multiplication symbol (×).

Joins in Relational Algebra

  • JOIN: Combines rows from two tables based on defined criteria. Types include natural join, theta join, equijoin, and outer join; denoted by symbol ⨝.
  • Natural Join: Results in a new table with rows having common values in shared attributes.

Steps in Natural Join Process

  • Step 1: Create the PRODUCT of the tables.
  • Step 2: Perform SELECT to keep rows with equal attribute values from Step 1.
  • Step 3: Perform PROJECT to provide a single copy of each attribute, eliminating duplicate columns.

Join Columns and Output Characteristics

  • Common columns from Step 2 are referred to as join columns.
  • JOIN results include join columns only once. If no match occurs between rows, unmatched rows are excluded from the result.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge of relational algebra and its set operators with these flashcards. Understand the core principles and functions such as SELECT, PROJECT, and JOIN. This quiz will help reinforce your understanding of relational database concepts.

More Quizzes Like This

Fundamental Relational Algebra Operators Quiz
12 questions
Relational Algebra Operations Quiz
21 questions
Relational Algebra Flashcards
14 questions
Relational Algebra Symbols Flashcards
8 questions
Use Quizgecko on...
Browser
Browser