1. Home
  2. Explore
  3. Computer Science
  4. Relational Algebra

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Relational Algebra

  • 77Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Foundations
Relational algebra is a
data manipulation language for the relational model.

77 questions

  1. 1
    Relational algebra is a
    _____
    data manipulation language for the relational model.
    Hint

    It specifies how data should be retrieved, not only what data is wanted.

    Answer

    procedural

  2. 2
    A relational algebra operation takes one or two relations as input and produces a new
    _____
    as its result.
    Hint

    The result has the same general form as a database table.

    Answer

    relation

  3. 3
    Multiple relational algebra operations combined together form a relational algebra
    _____
    .
    Hint

    It is a combination of operations that can be evaluated as a query.

    Answer

    expression

  4. 4
    In relational algebra, the operands are relations or variables that represent
    _____
    .
    Hint

    They are the data objects on which operators act.

    Answer

    relations

  5. 5
    Relational algebra operators map relations to
    _____
    .
    Hint

    The output of an operator remains a valid relational structure.

    Answer

    relations

  6. 6
    A tuple is an immutable ordered sequence of
    _____
    .
    Hint

    A tuple corresponds to a row and contains ordered data items.

    Answer

    values

  7. 7
    A relation is a group of tuples and is equivalent to a
    _____
    in a relational database.
    Hint

    It is organized into rows and attributes.

    Answer

    table

  8. 8
    An attribute is a field in a relation or
    _____
    .
    Hint

    It corresponds to a column.

    Answer

    table

  9. 9
    A domain specifies the data type of values permitted for a given
    _____
    .
    Hint

    It restricts what kind of values a column may contain.

    Answer

    attribute

  10. 10
    The four main categories of relational algebra operations are set, unary, binary, and
    _____
    operations.
    Hint

    This category includes generalized projection, aggregation, and outer join.

    Answer

    extended

  11. 11
    Set operations are binary operations because they operate on
    _____
    relations.
    Hint

    The opposite category discussed later operates on only one relation.

    Answer

    two

  12. 12
    The four set operations are union, intersection, set difference, and
    _____
    product.
    Hint

    This operation pairs every tuple in one relation with every tuple in another.

    Answer

    Cartesian

  13. 13
    The union of relations rrr and sss contains tuples from
    _____
    relation.
    Hint

    Union combines the contents of its two inputs.

    Answer

    both

  14. 14
    Duplicate tuples are
    _____
    when a union operation is performed.
    Hint

    Set operations do not retain repeated copies of the same tuple.

    Answer

    eliminated

  15. 15
    For union, the input relations must be
    _____
    compatible.
    Hint

    The compatibility requirement is named after the operation.

    Answer

    union

  16. 16
    If relations rrr and sss are union compatible, the degree of r∪sr \cup sr∪s equals the degree of
    _____
    .
    Hint

    Union does not add columns; it combines tuples with matching structures.

    Answer

    relations rrr and sss

  17. 17
    The intersection of rrr and sss contains tuples that belong to
    _____
    relations.
    Hint

    Think of the overlap between two sets.

    Answer

    both

  18. 18
    Like union, intersection requires the two relations to be
    _____
    compatible.
    Hint

    The inputs must have matching degrees and corresponding domains.

    Answer

    union

  19. 19
    In the example, the intersection of the writers and clients relations contains only
    _____
    .
    Hint

    It is the only record appearing in both relations.

    Answer

    John Cena

  20. 20
    The set difference r−sr - sr−s returns tuples that belong to rrr but
    _____
    belong to sss.
    Hint

    Difference removes tuples found in the second relation.

    Answer

    do not

  21. 21
    Unlike union and intersection, the
    _____
    of operands affects the result of set difference.
    Hint

    Switching the first and second relations changes which tuples are removed.

    Answer

    order

  22. 22
    The Cartesian product concatenates each tuple from rrr with
    _____
    tuple from sss.
    Hint

    Each tuple in the first relation is paired with all tuples in the second.

    Answer

    every

  23. 23
    The degree of r×sr \times sr×s equals the
    _____
    of the degrees of rrr and sss.
    Hint

    The attributes from both relations are combined.

    Answer

    sum

  24. 24
    If both input relations have four attributes, their Cartesian product has
    _____
    attributes.
    Hint

    Add the two degrees together.

    Answer

    eight

  25. 25
    Unlike union, intersection, and set difference, Cartesian product does not require the relations to be
    _____
    compatible.
    Hint

    The input relations may have different structures.

    Answer

    union

  26. 26
    The number of tuples in a Cartesian product equals the
    _____
    of the numbers of tuples in the two input relations.
    Hint

    Every tuple in one relation is paired with every tuple in the other.

    Answer

    product

  27. 27
    Unary operations take only
    _____
    input relation and also produce one relation.
    Hint

    The prefix uni- means single.

    Answer

    one

  28. 28
    The four unary operations presented are select, projection, rename, and
    _____
    .
    Hint

    This operation stores an intermediate result in a temporary variable.

    Answer

    assignment

  29. 29
    The select operation returns the subset of tuples that satisfies a selection
    _____
    .
    Hint

    It tests rows against a logical or comparison requirement.

    Answer

    condition

  30. 30
    Selection is called the
    _____
    filter because it selects rows and discards other rows.
    Hint

    Rows extend across a table.

    Answer

    horizontal

  31. 31
    Selection conditions may use comparison operators as well as AND, OR, and
    _____
    .
    Hint

    This operator is commonly used for pattern matching in text.

    Answer

    LIKE

  32. 32
    The projection operation returns tuples containing a subset of the original relation's
    _____
    .
    Hint

    Projection chooses columns rather than rows.

    Answer

    attributes

  33. 33
    Projection is called the
    _____
    filter because it selects columns.
    Hint

    Columns extend vertically in a table.

    Answer

    vertical

  34. 34
    To retrieve only first names from the actors relation, projection selects the
    _____
    attribute.
    Hint

    The query is intended to return a single name field.

    Answer

    first name

  35. 35
    The rename operation can rename a relation, its attributes, or
    _____
    .
    Hint

    It supports changing either kind of name independently or together.

    Answer

    both

  36. 36
    In the example, renaming the directors relation changes its relation name to
    _____
    .
    Hint

    The new name describes a different role in film production.

    Answer

    producers

  37. 37
    Assignment stores an intermediate query result in a temporary
    _____
    variable.
    Hint

    The assigned result can be used as an input to later operations.

    Answer

    relation

  38. 38
    Assignment expresses a complex query as a sequential program of assignments followed by an
    _____
    whose value is displayed.
    Hint

    The final operation determines the query output.

    Answer

    expression

  39. 39
    In the example, actors with gender equal to M are assigned to the temporary variable
    _____
    .
    Hint

    The variable name describes the selected group.

    Answer

    male actors

  40. 40
    A binary operation combines
    _____
    input relations into one output relation.
    Hint

    Binary means involving a pair.

    Answer

    two

  41. 41
    The four binary operations presented are data join, equi-join, natural join, and
    _____
    .
    Hint

    This operation returns tuples associated with every tuple in another relation.

    Answer

    division

  42. 42
    A data join combines two relations based on a condition represented by the Greek letter
    _____
    .
    Hint

    The operation is also called a conditional join and uses comparison conditions.

    Answer

    theta

  43. 43
    A data join using only the equivalence condition is called an
    _____
    .
    Hint

    The prefix indicates equality.

    Answer

    equi-join

  44. 44
    In an equi-join, tuples are matched when the selected attributes have
    _____
    values.
    Hint

    The condition is based on the equals operator.

    Answer

    equal

  45. 45
    A natural join requires at least one
    _____
    attribute between the two relations.
    Hint

    The matching attribute must appear in both relations.

    Answer

    common

  46. 46
    The common attributes in a natural join must have the same name and
    _____
    .
    Hint

    Matching columns must permit the same type of values.

    Answer

    domain

  47. 47
    Natural join performs selection based on equality of common attributes and eliminates the
    _____
    attribute.
    Hint

    The shared column should not appear twice in the result.

    Answer

    duplicate

  48. 48
    Attributes used in the division operation are not included in the
    _____
    .
    Hint

    The output keeps the attributes identifying the qualifying tuples.

    Answer

    result

  49. 49
    In the laptop divided by PC example, the resulting attributes are model and
    _____
    .
    Hint

    The speed attribute is used for division and is therefore omitted.

    Answer

    price

  50. 50
    Generalized projection extends ordinary projection by allowing
    _____
    functions in the projection list.
    Hint

    These functions can calculate new values from attributes.

    Answer

    arithmetic

  51. 51
    In generalized projection, the expression EEE represents a relational algebra
    _____
    .
    Hint

    It identifies the relation or operation being projected.

    Answer

    expression

  52. 52
    To calculate credit consumed, the credit company's generalized projection subtracts credit balance from credit
    _____
    .
    Hint

    The amount available minus the amount already owed gives the remaining difference.

    Answer

    limit

  53. 53
    Aggregate functions take a collection of values as input and return a
    _____
    value.
    Hint

    Aggregation summarizes multiple values.

    Answer

    single

  54. 54
    The aggregate operations presented are sum, average, count, min, and
    _____
    .
    Hint

    It returns the greatest value in a collection.

    Answer

    max

  55. 55
    In the department salary example, the department is used as the
    _____
    attribute.
    Hint

    It determines how employees are grouped before salaries are totaled.

    Answer

    group

  56. 56
    The aggregation example uses the
    _____
    function to calculate total salary.
    Hint

    The goal is to add all salaries within each department.

    Answer

    sum

  57. 57
    An outer join differs from an ordinary join by retaining unmatched tuples and padding missing values with
    _____
    .
    Hint

    This special database value represents unavailable data.

    Answer

    null

  58. 58
    The three variations of outer join are left outer join, right outer join, and
    _____
    outer join.
    Hint

    This variation preserves tuples from both sides.

    Answer

    full

  59. 59
    A left outer join keeps all tuples from the
    _____
    relation.
    Hint

    The name identifies which side is preserved.

    Answer

    left

  60. 60
    A right outer join keeps all tuples from the
    _____
    relation.
    Hint

    The preserved side corresponds to the operation's name.

    Answer

    right

  61. 61
    A full outer join keeps tuples from
    _____
    relations.
    Hint

    Neither side is discarded, even when there is no match.

    Answer

    both

  62. 62
    In the square-and-cube example, a left outer join includes number 4 with a null value for its
    _____
    .
    Hint

    Number 4 exists in the relation containing square values but not in the other relation.

    Answer

    cube

  63. 63
    In the same example, a right outer join includes number 5 with a null value for its
    _____
    .
    Hint

    Number 5 exists in the cube relation but not in the square relation.

    Answer

    square

  64. 64
    A full outer join can place null values on
    _____
    relations for unmatched tuples.
    Hint

    It preserves unmatched records from either input.

    Answer

    both

  65. 65
    Outer union is similar to union but also considers common attributes that are not necessarily
    _____
    compatible.
    Hint

    The issue concerns whether corresponding attributes use compatible data types.

    Answer

    type

  66. 66
    Outer union is equivalent to a full outer join using the
    _____
    attributes.
    Hint

    The join is based on attributes shared by both relations.

    Answer

    common

  67. 67
    In an outer union, common columns are
    _____
    into one column.
    Hint

    The duplicate representation of shared attributes is combined.

    Answer

    merged

  68. 68
    Outer union places null values in fields corresponding to
    _____
    data.
    Hint

    These fields have no value because the attribute is absent in one input.

    Answer

    non-existing

  69. 69
    In the outer union example, the increment column receives
    _____
    instead of null because it has a defined data type.
    Hint

    This is the numeric default shown for missing integer data.

    Answer

    zero

  70. 70
    To make two relations union compatible, a projection can be used to select matching attributes such as id, first name, and
    _____
    name.
    Hint

    The three selected attributes identify a person.

    Answer

    last

  71. 71
    In the exercise, the list of clients who are administrators can be obtained by combining selection with a
    _____
    operation.
    Hint

    The exercise asks students to find an operation or combination of operations that produces the desired list.

    Answer

    set

  72. 72
    The exercise asking for admins who are not writers requires the
    _____
    operation to exclude writers.
    Hint

    This operation keeps tuples in the first relation that are absent from the second.

    Answer

    set difference

  73. 73
    The challenge asks for the number of movies made by each director whose movie rank is at least
    _____
    .
    Hint

    The challenge specifies a threshold using an equality-or-greater condition.

    Answer

    8

  74. 74
    The challenge restricts the movies to those shown between 1960 and the year
    _____
    .
    Hint

    The time interval ends at the beginning of the twenty-first century.

    Answer

    2000

  75. 75
    The challenge requires grouping the qualifying movies by
    _____
    to count the number made by each one.
    Hint

    The result should report a movie count for each person responsible for directing.

    Answer

    director

  76. 76
    The exercise using generalized projection asks for the total cost of each laptop after adding a delivery charge of
    _____
    pesos.
    Hint

    The fixed charge is added to every laptop's cost.

    Answer

    200

  77. 77
    The binary-operation exercise asks for PCs that are more
    _____
    than a laptop.
    Hint

    The comparison concerns the monetary price of the two products.

    Answer

    expensive

1 of 77
Question 1 of 77

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent