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

  • 75Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Foundations

What is relational algebra?

75 questions

  1. 1

    What is relational algebra?

    1. A

      A storage format for unstructured multimedia files

    2. B

      A programming language for defining operating systems

    3. C

      A procedural data manipulation language for the relational model

    4. D

      A graphical language for designing network topologies

    Correct answer
    C

    A procedural data manipulation language for the relational model

    Explanation

    Relational algebra is a procedural data manipulation language used with the relational model. Users specify how the desired data should be retrieved.

  2. 2

    What does it mean that relational algebra is procedural?

    1. A

      The user can modify only the physical storage location of data

    2. B

      The database automatically chooses all operations without user input

    3. C

      The user describes data values without specifying retrieval steps

    4. D

      The user specifies the operations used to retrieve the expected data

    Correct answer
    D

    The user specifies the operations used to retrieve the expected data

    Explanation

    A procedural language requires the user to specify how the expected data should be retrieved.

  3. 3

    What do relational algebra operations take as input and produce as output?

    1. A

      Only individual attribute values as input and a scalar as output

    2. B

      A query string as input and a physical disk page as output

    3. C

      One or two relations as input and a new relation as output

    4. D

      A complete database as input and a text file as output

    Correct answer
    C

    One or two relations as input and a new relation as output

    Explanation

    Relational algebra operations take one or two relations as input and produce a new relation as the result.

  4. 4

    What forms a relational algebra expression?

    1. A

      A list of database users and their permissions

    2. B

      A single attribute value stored in a relation

    3. C

      A physical index created for a database table

    4. D

      Multiple relational algebra operations combined together

    Correct answer
    D

    Multiple relational algebra operations combined together

    Explanation

    Multiple relational algebra operations can be combined to form a relational algebra expression.

  5. 5

    In relational algebra, what are the operands?

    1. A

      Comparison operators such as equals and less than

    2. B

      Relations or variables that represent relations

    3. C

      Physical files containing database backups

    4. D

      Individual database domains without any relation

    Correct answer
    B

    Relations or variables that represent relations

    Explanation

    The operands in relational algebra are relations or variables representing relations.

  6. 6

    What is the role of an operator in relational algebra?

    1. A

      It identifies the hardware device holding a relation

    2. B

      It converts every relation into a single numerical value

    3. C

      It maps relations to relations according to combination and evaluation rules

    4. D

      It permanently changes the data type of every attribute

    Correct answer
    C

    It maps relations to relations according to combination and evaluation rules

    Explanation

    Relational algebra operators map relations to relations and provide rules for combining operands and evaluating expressions.

  7. 7

    Which list correctly identifies the four categories of relational algebra operations presented?

    1. A

      Sorting, indexing, storage, and security operations

    2. B

      Text, numeric, logical, and physical operations

    3. C

      Input, processing, output, and backup operations

    4. D

      Set, unary, binary, and extended operations

    Correct answer
    D

    Set, unary, binary, and extended operations

    Explanation

    The four categories are set operations, unary operations, binary operations, and extended operations.

  8. 8

    What is a tuple in the relational model?

    1. A

      A collection of relations stored in one database

    2. B

      A field name used to identify a table

    3. C

      An immutable ordered sequence of values representing a row

    4. D

      A data type permitted for a particular attribute

    Correct answer
    C

    An immutable ordered sequence of values representing a row

    Explanation

    A tuple is an immutable ordered sequence of values and is equivalent to a row in a relational database.

  9. 9

    What is a relation in a relational database?

    1. A

      A comparison between two attribute values

    2. B

      A permitted data type for one field

    3. C

      A group of tuples equivalent to a table

    4. D

      A single field inside a table

    Correct answer
    C

    A group of tuples equivalent to a table

    Explanation

    A relation is a group of tuples and is equivalent to a table in a relational database.

  10. 10

    What is an attribute?

    1. A

      A field or column in a relation

    2. B

      A sequence of operations in a query

    3. C

      A complete collection of rows

    4. D

      A data type shared by all relations

    Correct answer
    A

    A field or column in a relation

    Explanation

    An attribute is a field in a relation or table.

  11. 11

    What is a domain?

    1. A

      The data type of values permitted for a particular attribute

    2. B

      The set of operations applied to two relations

    3. C

      The number of tuples contained in a relation

    4. D

      The name assigned to a temporary query variable

    Correct answer
    A

    The data type of values permitted for a particular attribute

    Explanation

    A domain specifies the data type of values permitted for a given attribute.

  12. 12

    When are two relations union-compatible?

    1. A

      When they have the same number of tuples but different attributes

    2. B

      When they contain at least one identical tuple regardless of degree

    3. C

      When they have the same degree and corresponding attributes share the same domains

    4. D

      When every attribute in one relation has a unique name

    Correct answer
    C

    When they have the same degree and corresponding attributes share the same domains

    Explanation

    Union-compatible relations have the same degree, and corresponding attributes are defined on the same domains.

  13. 13

    Why are union, intersection, set difference, and Cartesian product classified as binary operations?

    1. A

      Each operation returns exactly two attributes

    2. B

      Each operation can be performed only twice

    3. C

      Each operation requires two database users

    4. D

      Each operation uses two relations as operands

    Correct answer
    D

    Each operation uses two relations as operands

    Explanation

    Set operations are binary because they operate on two relations.

  14. 14

    What is the result of the union of relations R and S?

    1. A

      All tuples appearing in R or S, with duplicates removed

    2. B

      Only tuples appearing in both R and S, with duplicates retained

    3. C

      Every possible pairing of a tuple from R with one from S

    4. D

      Tuples in R that do not appear anywhere in S

    Correct answer
    A

    All tuples appearing in R or S, with duplicates removed

    Explanation

    Union combines the tuples from both relations and eliminates duplicates.

  15. 15

    What degree does the result of a valid union have?

    1. A

      The sum of the degrees of the input relations

    2. B

      The degree of only the first input relation

    3. C

      The number of tuples in the second input relation

    4. D

      The same degree as both input relations

    Correct answer
    D

    The same degree as both input relations

    Explanation

    For union-compatible relations, the result has the same number of attributes as either input relation.

  16. 16

    A student attempts to union the Actors and Directors relations, but they are not union-compatible. What is the most appropriate solution?

    1. A

      Apply Cartesian product and assume incompatible attributes will disappear

    2. B

      Rename the entire database so all relations become compatible

    3. C

      Project matching attributes from one relation before performing the union

    4. D

      Use set difference because it does not require compatible relations

    Correct answer
    C

    Project matching attributes from one relation before performing the union

    Explanation

    Projection can reduce one relation to matching attributes, such as ID, first name, and last name, so that the relations become union-compatible.

  17. 17

    What does the intersection of relations R and S return?

    1. A

      Tuples that occur in both R and S

    2. B

      All tuples from R followed by all tuples from S

    3. C

      Tuples that occur only in R

    4. D

      Every possible pairing between R and S

    Correct answer
    A

    Tuples that occur in both R and S

    Explanation

    Intersection returns the tuples shared by both relations, with duplicates removed.

  18. 18

    Which condition is required before performing an intersection?

    1. A

      The two relations must contain completely different tuples

    2. B

      The two relations must be union-compatible

    3. C

      The two relations must have different degrees

    4. D

      The two relations must have no common attribute names

    Correct answer
    B

    The two relations must be union-compatible

    Explanation

    Like union, intersection requires the input relations to be union-compatible.

  19. 19

    If John Cena appears in both the Writers and Clients relations, what happens to John Cena in their intersection?

    1. A

      John Cena appears only if he occurs twice in the first relation

    2. B

      John Cena is placed in a separate difference relation

    3. C

      John Cena appears in the intersection

    4. D

      John Cena is removed because duplicates are forbidden

    Correct answer
    C

    John Cena appears in the intersection

    Explanation

    Intersection contains tuples present in both input relations, so John Cena appears in the result.

  20. 20

    What does the set difference R minus S return?

    1. A

      Tuples in S that are not in R

    2. B

      Tuples in R that are not in S

    3. C

      Tuples that occur in both R and S

    4. D

      All tuples from R and S combined

    Correct answer
    B

    Tuples in R that are not in S

    Explanation

    Set difference returns tuples belonging to the first relation but not to the second.

  21. 21

    Why does the order of operands matter in set difference?

    1. A

      The second relation determines the degree of the result

    2. B

      R minus S and S minus R generally select different base relations

    3. C

      Set difference automatically changes into intersection when reversed

    4. D

      The first relation is always discarded after comparison

    Correct answer
    B

    R minus S and S minus R generally select different base relations

    Explanation

    R minus S finds tuples in R but not S, whereas S minus R finds tuples in S but not R.

  22. 22

    If John Cena appears in both Writers and Clients, why is he excluded from Writers minus Clients?

    1. A

      He is excluded because set difference removes every writer

    2. B

      He is excluded because set difference returns only shared tuples

    3. C

      He is excluded because the two relations have different degrees

    4. D

      He is not exclusive to Writers because he also appears in Clients

    Correct answer
    D

    He is not exclusive to Writers because he also appears in Clients

    Explanation

    A tuple is included in Writers minus Clients only if it appears in Writers and does not appear in Clients.

  23. 23

    What does the Cartesian product R cross S produce?

    1. A

      Only tuples appearing in both R and S

    2. B

      Only tuples that have equal values in corresponding attributes

    3. C

      A concatenated tuple for every tuple in R paired with every tuple in S

    4. D

      Tuples in R after removing attributes found in S

    Correct answer
    C

    A concatenated tuple for every tuple in R paired with every tuple in S

    Explanation

    The Cartesian product pairs each tuple in R with every tuple in S and concatenates their attributes.

  24. 24

    If R has four attributes and S has four attributes, what is the degree of their Cartesian product?

    1. A

      The number of attributes in R minus S

    2. B

      Sixteen attributes

    3. C

      Eight attributes

    4. D

      Four attributes

    Correct answer
    C

    Eight attributes

    Explanation

    The degree of a Cartesian product is the sum of the degrees of its inputs, so it is 4+4=84 + 4 = 84+4=8 attributes.

  25. 25

    If R contains mmm tuples and S contains nnn tuples, how many tuples can their Cartesian product contain?

    1. A

      mmm tuples only

    2. B

      m+nm + nm+n tuples

    3. C

      m−nm - nm−n tuples

    4. D

      m×nm \times nm×n tuples

    Correct answer
    D

    m×nm \times nm×n tuples

    Explanation

    Each of the mmm tuples in R is paired with each of the nnn tuples in S, producing m×nm \times nm×n pairings.

  26. 26

    Which statement about Cartesian product differs from the requirements for union and intersection?

    1. A

      Its input relations must have identical domains

    2. B

      Its input relations must contain matching tuples

    3. C

      Its input relations must have the same degree

    4. D

      Its input relations do not need to be union-compatible

    Correct answer
    D

    Its input relations do not need to be union-compatible

    Explanation

    Unlike union, intersection, and set difference, Cartesian product does not require union compatibility.

  27. 27

    What is the defining characteristic of a unary relational algebra operation?

    1. A

      It takes one relation as input and returns one relation

    2. B

      It takes two relations and returns a scalar value

    3. C

      It takes two relations and always concatenates their tuples

    4. D

      It takes one attribute and returns a complete database

    Correct answer
    A

    It takes one relation as input and returns one relation

    Explanation

    Unary operations use a single relation as input and produce a relation as output.

  28. 28

    Which set correctly lists the four unary operations presented?

    1. A

      Sum, average, count, and maximum

    2. B

      Union, intersection, difference, and product

    3. C

      Theta join, equijoin, natural join, and division

    4. D

      Select, projection, rename, and assignment

    Correct answer
    D

    Select, projection, rename, and assignment

    Explanation

    The four unary operations discussed are select, projection, rename, and assignment.

  29. 29

    What does the selection operation return?

    1. A

      A new relation formed from every tuple pairing

    2. B

      A subset of rows satisfying a selection condition

    3. C

      A subset of columns without filtering any rows

    4. D

      A single aggregate value from an entire relation

    Correct answer
    B

    A subset of rows satisfying a selection condition

    Explanation

    Selection filters tuples according to a condition and returns the qualifying rows.

  30. 30

    Why is selection called a horizontal filter?

    1. A

      It selects some columns while discarding other columns

    2. B

      It combines rows from two unrelated relations

    3. C

      It selects some rows while discarding other rows

    4. D

      It changes the order of attributes from left to right

    Correct answer
    C

    It selects some rows while discarding other rows

    Explanation

    Selection filters rows, so it is described as a horizontal filter.

  31. 31

    Which condition could be used in a selection operation?

    1. A

      A comparison involving operators such as equals, less than, AND, OR, or LIKE

    2. B

      Only a list of attribute names separated by commas

    3. C

      A requirement that every tuple be paired with every other tuple

    4. D

      Only the name of a second relation

    Correct answer
    A

    A comparison involving operators such as equals, less than, AND, OR, or LIKE

    Explanation

    Selection conditions may use comparison operators and logical operators such as AND, OR, and LIKE.

  32. 32

    Which selection retrieves movies released in 2003 with a rank greater than 7?

    1. A

      A projection of year and rank from the Movies relation

    2. B

      A condition requiring year equals 2003 AND rank greater than 7

    3. C

      A condition requiring year greater than 2003 OR rank equals 7

    4. D

      A Cartesian product of year and rank relations

    Correct answer
    B

    A condition requiring year equals 2003 AND rank greater than 7

    Explanation

    The stated result requires both conditions: the year must equal 2003 and the rank must be greater than 7.

  33. 33

    What does projection return?

    1. A

      A relation containing every possible tuple pairing

    2. B

      A relation containing only tuples that satisfy a condition

    3. C

      A relation containing a selected subset of attributes

    4. D

      A scalar containing the total of one attribute

    Correct answer
    C

    A relation containing a selected subset of attributes

    Explanation

    Projection selects columns or attributes from a relation.

  34. 34

    Why is projection called a vertical filter?

    1. A

      It orders tuples according to an attribute

    2. B

      It selects some columns while discarding other columns

    3. C

      It selects some rows while discarding other rows

    4. D

      It vertically concatenates two relations

    Correct answer
    B

    It selects some columns while discarding other columns

    Explanation

    Projection filters attributes or columns, so it is described as a vertical filter.

  35. 35

    Which operation should be used to retrieve only the first names from the Actors relation?

    1. A

      Selection using the first-name attribute

    2. B

      Projection of the first-name attribute

    3. C

      Cartesian product with the first-name attribute

    4. D

      Division by the first-name attribute

    Correct answer
    B

    Projection of the first-name attribute

    Explanation

    Projection is used to retain selected attributes, such as first name, while discarding other columns.

  36. 36

    What can the rename operation change?

    1. A

      Only the physical location of the relation

    2. B

      The relation name, attribute names, or both

    3. C

      Only the number of tuples in a relation

    4. D

      Only the domains of all attributes

    Correct answer
    B

    The relation name, attribute names, or both

    Explanation

    Rename can change the name of a relation, the names of its attributes, or both.

  37. 37

    What is the purpose of assignment in relational algebra?

    1. A

      It stores an intermediate relation in a temporary variable for a sequential query

    2. B

      It permanently changes the values stored in the original relation

    3. C

      It removes all temporary results from a database

    4. D

      It converts a relation into a domain definition

    Correct answer
    A

    It stores an intermediate relation in a temporary variable for a sequential query

    Explanation

    Assignment gives an intermediate result a temporary variable name so it can be used in later operations.

  38. 38

    Which sequence best illustrates assignment in a complex query?

    1. A

      Rename an attribute, convert it to a domain, then calculate a Cartesian product

    2. B

      Project every relation, delete the result, then select the deleted tuples

    3. C

      Select actors where gender is male, assign the result to MaleActors, then project from MaleActors

    4. D

      Union two incompatible relations, assign a scalar, then divide by an attribute

    Correct answer
    C

    Select actors where gender is male, assign the result to MaleActors, then project from MaleActors

    Explanation

    Assignment supports sequential queries by storing an intermediate result, such as male actors, for later projection or other operations.

  39. 39

    What is a binary relational algebra operation?

    1. A

      An operation that combines two input relations into one output relation

    2. B

      An operation that renames two attributes in one relation

    3. C

      An operation that filters one relation using one condition

    4. D

      An operation that returns only one aggregate value

    Correct answer
    A

    An operation that combines two input relations into one output relation

    Explanation

    Binary operations combine two input relations and produce one output relation.

  40. 40

    Which list contains the four binary operations presented?

    1. A

      Union, intersection, difference, and Cartesian product

    2. B

      Selection, projection, rename, and assignment

    3. C

      Theta join, equijoin, natural join, and division

    4. D

      Generalized projection, aggregation, outer join, and outer union

    Correct answer
    C

    Theta join, equijoin, natural join, and division

    Explanation

    The binary operations discussed are theta join, equijoin, natural join, and division.

  41. 41

    What condition does a theta join use?

    1. A

      A requirement that the two relations have the same degree

    2. B

      No condition, because every possible pairing is always retained

    3. C

      A specified comparison condition between attributes of two relations

    4. D

      A requirement that all attributes have identical names

    Correct answer
    C

    A specified comparison condition between attributes of two relations

    Explanation

    A theta join, also called a conditional join, joins relations according to a comparison condition.

  42. 42

    How does an equijoin differ from a general theta join?

    1. A

      An equijoin requires no condition between the relations

    2. B

      An equijoin can operate on only one relation

    3. C

      An equijoin uses only inequality as its join condition

    4. D

      An equijoin uses only equality as its join condition

    Correct answer
    D

    An equijoin uses only equality as its join condition

    Explanation

    An equijoin is a theta join restricted to the equivalence condition.

  43. 43

    What must be true for a natural join?

    1. A

      The relations must have identical numbers of tuples

    2. B

      The relations must have no attributes with matching names

    3. C

      The relations must be union-compatible in every attribute

    4. D

      The relations must share at least one attribute with the same name and domain

    Correct answer
    D

    The relations must share at least one attribute with the same name and domain

    Explanation

    A natural join uses common attributes with the same name and domain, and at least one such attribute must exist.

  44. 44

    How does a natural join handle common attributes after matching tuples?

    1. A

      It changes the common attribute into a temporary variable

    2. B

      It duplicates every common attribute three times

    3. C

      It removes all common attributes from the result

    4. D

      It eliminates the duplicate copy of the common attribute

    Correct answer
    D

    It eliminates the duplicate copy of the common attribute

    Explanation

    Natural join matches tuples on common attributes and eliminates the duplicate attribute in the result.

  45. 45

    Which operation would be most appropriate for joining Product and PC using their shared Model attribute without retaining two copies of Model?

    1. A

      Unary selection

    2. B

      Aggregation

    3. C

      Natural join

    4. D

      Set difference

    Correct answer
    C

    Natural join

    Explanation

    A natural join uses the common Model attribute for equality matching and removes the duplicate copy.

  46. 46

    What does relational division return?

    1. A

      Tuples from the first relation associated with at least one tuple in the second relation

    2. B

      Tuples from the first relation associated with every tuple in the second relation

    3. C

      Only tuples that have unequal values in both relations

    4. D

      All concatenated tuples from both input relations

    Correct answer
    B

    Tuples from the first relation associated with every tuple in the second relation

    Explanation

    Division returns tuples from the first relation that are associated with every tuple of the second relation.

  47. 47

    Which attributes are typically absent from the result of relational division?

    1. A

      Every attribute that contains a numerical value

    2. B

      All attributes from the second relation except the divisor

    3. C

      The attributes used as the divisor or division-matching attributes

    4. D

      All attributes from the first relation

    Correct answer
    C

    The attributes used as the divisor or division-matching attributes

    Explanation

    The attributes used in the division are not included in the result; for example, dividing by speed can return model and price without speed.

  48. 48

    Which statement best distinguishes generalized projection from ordinary projection?

    1. A

      Generalized projection filters rows but cannot select columns

    2. B

      Generalized projection permits arithmetic expressions in the projection list

    3. C

      Generalized projection always requires two input relations

    4. D

      Generalized projection returns only a single aggregate value

    Correct answer
    B

    Generalized projection permits arithmetic expressions in the projection list

    Explanation

    Generalized projection extends projection by allowing arithmetic functions or expressions on attributes.

  49. 49

    A credit company wants to calculate credit consumed as credit limit minus credit balance for every customer. Which operation is appropriate?

    1. A

      Set intersection

    2. B

      Natural join

    3. C

      Relational division

    4. D

      Generalized projection

    Correct answer
    D

    Generalized projection

    Explanation

    Generalized projection can calculate an expression such as credit limit minus credit balance and return it as a derived attribute.

  50. 50

    What do aggregate functions do?

    1. A

      They combine two relations without comparing attributes

    2. B

      They take a collection of values and return a single value

    3. C

      They rename all attributes in a relation

    4. D

      They take one tuple and return every tuple in a relation

    Correct answer
    B

    They take a collection of values and return a single value

    Explanation

    Aggregate functions summarize a collection of values into one result.

  51. 51

    Which set contains only aggregate operations presented in the content?

    1. A

      Select, project, rename, and assignment

    2. B

      Sum, average, count, minimum, and maximum

    3. C

      Equals, less than, greater than, and LIKE

    4. D

      Union, intersection, difference, and product

    Correct answer
    B

    Sum, average, count, minimum, and maximum

    Explanation

    The aggregate functions presented are sum, average, count, min, and max.

  52. 52

    In an aggregation query for total salary in each department, what is the department attribute used for?

    1. A

      It is the temporary relation variable

    2. B

      It is the grouping attribute

    3. C

      It is the comparison operator

    4. D

      It is the aggregate function

    Correct answer
    B

    It is the grouping attribute

    Explanation

    Department identifies the groups, while sum of salary produces the aggregate value for each group.

  53. 53

    What happens when the grouping attributes are omitted from an aggregation?

    1. A

      The aggregate can be applied without dividing the input into groups

    2. B

      Every attribute becomes a grouping attribute

    3. C

      The relation is automatically converted into a Cartesian product

    4. D

      The aggregation becomes a selection condition

    Correct answer
    A

    The aggregate can be applied without dividing the input into groups

    Explanation

    The grouping-attribute portion can be omitted depending on the query, allowing aggregation over the relevant collection without explicit groups.

  54. 54

    What is the main purpose of an outer join?

    1. A

      To combine only relations with identical degrees

    2. B

      To calculate an aggregate for each matching tuple

    3. C

      To retain unmatched tuples and fill missing values with nulls

    4. D

      To remove every tuple that lacks a matching tuple

    Correct answer
    C

    To retain unmatched tuples and fill missing values with nulls

    Explanation

    Outer joins retain tuples that do not have matches and pad the missing side with null values.

  55. 55

    What does a left outer join preserve?

    1. A

      Only tuples that are absent from both relations

    2. B

      All tuples from the right relation

    3. C

      Only tuples from both relations that match

    4. D

      All tuples from the left relation

    Correct answer
    D

    All tuples from the left relation

    Explanation

    A left outer join keeps every tuple from the left relation and adds nulls for unmatched values on the right.

  56. 56

    What does a right outer join preserve?

    1. A

      Only tuples with null values on the left

    2. B

      Only tuples that match on both sides

    3. C

      All tuples from the right relation

    4. D

      All tuples from the left relation

    Correct answer
    C

    All tuples from the right relation

    Explanation

    A right outer join keeps every tuple from the right relation and pads unmatched left-side attributes with nulls.

  57. 57

    What does a full outer join preserve?

    1. A

      Only tuples from the relation named first

    2. B

      All tuples from both relations, with nulls where matches are absent

    3. C

      Only tuples whose join condition evaluates to true

    4. D

      Only tuples containing common attributes

    Correct answer
    B

    All tuples from both relations, with nulls where matches are absent

    Explanation

    A full outer join preserves tuples from both relations and places null values on either side when no matching tuple exists.

  58. 58

    In the example using a left outer join between relations A and B, why does an A tuple for number 4 have a null cube value?

    1. A

      Number 4 exists in both relations but violates the join condition

    2. B

      Number 4 exists in A but has no matching tuple in B

    3. C

      The cube attribute is always null in a left outer join

    4. D

      Number 4 exists only in B and is removed from the result

    Correct answer
    B

    Number 4 exists in A but has no matching tuple in B

    Explanation

    A left outer join retains the A tuple, and because number 4 is absent from B, the corresponding B value is null.

  59. 59

    In the example using a right outer join between relations A and B, why does a B tuple for number 5 have a null square value?

    1. A

      Number 5 exists in A but not in B

    2. B

      The square attribute is always null in a right outer join

    3. C

      Right outer joins remove all unmatched B tuples

    4. D

      Number 5 exists in B but has no matching tuple in A

    Correct answer
    D

    Number 5 exists in B but has no matching tuple in A

    Explanation

    The right outer join preserves the B tuple, while the missing A tuple causes the square value to be null.

  60. 60

    If a left outer join is performed between Employees and Photographers, and Employees has seven tuples, how many result rows are expected when every employee is retained?

    1. A

      Only the number of matching photographers

    2. B

      Three rows

    3. C

      Seven rows

    4. D

      Ten rows

    Correct answer
    C

    Seven rows

    Explanation

    Because the Employees relation is on the left and all its tuples are retained, the result contains seven rows in the described example.

  61. 61

    If two relations each contain three tuples and a full outer join produces six rows in the example, what does that indicate?

    1. A

      The relations were first converted into union-compatible projections

    2. B

      The join automatically performed aggregation on the six values

    3. C

      The tuples from both relations are preserved, including unmatched tuples

    4. D

      Only matching tuples were retained and each was duplicated

    Correct answer
    C

    The tuples from both relations are preserved, including unmatched tuples

    Explanation

    The six-row result reflects preservation of all three tuples from each relation, with nulls for nonmatching data.

  62. 62

    How does outer union extend ordinary union?

    1. A

      It returns only tuples shared by both input relations

    2. B

      It requires every attribute to have a different name and domain

    3. C

      It combines common attributes even when noncommon attributes are not type-compatible

    4. D

      It pairs every tuple in one relation with every tuple in the other

    Correct answer
    C

    It combines common attributes even when noncommon attributes are not type-compatible

    Explanation

    Outer union considers common attributes and can combine relations even when other attributes are not necessarily type-compatible.

  63. 63

    What happens to nonexisting data in an outer union result?

    1. A

      The missing values are replaced by every value in the other relation

    2. B

      The tuples containing missing data are always discarded

    3. C

      Null values or type-appropriate default values are placed in the missing attributes

    4. D

      The missing attributes are renamed to match the relation name

    Correct answer
    C

    Null values or type-appropriate default values are placed in the missing attributes

    Explanation

    Outer union includes tuples from both relations and fills attributes absent from one relation with nulls or appropriate defaults.

  64. 64

    In the outer-union example, why can the increment column receive zero instead of null?

    1. A

      Outer union always replaces every missing value with zero

    2. B

      The column exists in both relations with identical values

    3. C

      Its defined data type allows a type-appropriate default value

    4. D

      The increment column is used as the join condition

    Correct answer
    C

    Its defined data type allows a type-appropriate default value

    Explanation

    The content explains that a typed attribute such as increment can receive zero as a default, whereas an unspecified type may receive null.

  65. 65

    How is outer union related to a full outer join?

    1. A

      Outer union is equivalent to a selection on one relation

    2. B

      Outer union is equivalent to a Cartesian product with no condition

    3. C

      Outer union is equivalent to a left outer join using unrelated attributes

    4. D

      Outer union is equivalent to a full outer join using common attributes

    Correct answer
    D

    Outer union is equivalent to a full outer join using common attributes

    Explanation

    The content describes outer union as equivalent to a full outer join with the common attributes.

  66. 66

    Which operation should be used to find all actors whose names start with "Ch"?

    1. A

      Selection using a pattern-matching condition such as LIKE

    2. B

      Division by the Actors relation

    3. C

      Projection of the first-name and last-name attributes

    4. D

      Aggregation using count on the name attribute

    Correct answer
    A

    Selection using a pattern-matching condition such as LIKE

    Explanation

    Finding names that start with a pattern requires selection with a pattern-matching condition such as LIKE.

  67. 67

    To obtain the first and last names of actors whose first name is Stanley and label the output attributes FName and LName, which sequence is appropriate?

    1. A

      Select Stanley actors, project first and last names, then rename the attributes

    2. B

      Perform a full outer join, select nulls, then union the result

    3. C

      Project every attribute, divide by Stanley, then apply set difference

    4. D

      Rename the relation, calculate an aggregate, then perform a Cartesian product

    Correct answer
    A

    Select Stanley actors, project first and last names, then rename the attributes

    Explanation

    The task combines selection on first name, projection of first and last names, and renaming those attributes.

  68. 68

    How can the total cost of each laptop model after a delivery charge be obtained?

    1. A

      Use intersection to retain only laptops with matching delivery charges

    2. B

      Use division to remove the cost attribute from each laptop

    3. C

      Use rename to calculate a new numerical value

    4. D

      Use generalized projection to add the delivery charge to the laptop cost

    Correct answer
    D

    Use generalized projection to add the delivery charge to the laptop cost

    Explanation

    Generalized projection supports arithmetic expressions, such as adding 200 pesos to each laptop cost.

  69. 69

    Which relational algebra strategy retrieves employees using the Department relation while retaining employees without a department match?

    1. A

      Use projection alone because projection matches department identifiers

    2. B

      Use intersection because unmatched employees should be retained

    3. C

      Use division because every employee must belong to every department

    4. D

      Use an outer join involving the Employees and Department relations

    Correct answer
    D

    Use an outer join involving the Employees and Department relations

    Explanation

    An outer join is appropriate when the result should include employees even when no matching department tuple exists.

  70. 70

    To find the number of movies made by each director, what operation is needed after filtering movies ranked at least 8 and shown from 1960 through 2000?

    1. A

      Aggregation with count grouped by director

    2. B

      Set difference between movies and directors

    3. C

      Natural join without any selection condition

    4. D

      Projection without grouping by director

    Correct answer
    A

    Aggregation with count grouped by director

    Explanation

    The challenge requires filtering by rank and year, associating movies with directors, and then counting movies for each director group.

  71. 71

    Why might unary operations be performed before a set operation in a complex query?

    1. A

      They automatically convert every binary operation into an aggregate

    2. B

      They can filter or project relations so that the desired set operation becomes possible

    3. C

      They prevent any relation from being used more than once

    4. D

      They ensure that all tuples are duplicated before union

    Correct answer
    B

    They can filter or project relations so that the desired set operation becomes possible

    Explanation

    Selection and projection can produce intermediate relations with the needed rows or matching attributes before a set operation is applied.

  72. 72

    A query combines Actors and MovieGenres, assigns the result to T, and then selects tuples where genre equals action. What is the purpose of T?

    1. A

      T stores the intermediate combined relation for the later selection

    2. B

      T represents the comparison operator used by the selection

    3. C

      T permanently replaces both original relations

    4. D

      T contains only the attributes removed by projection

    Correct answer
    A

    T stores the intermediate combined relation for the later selection

    Explanation

    Assignment stores the intermediate result under the variable T, allowing the later selection to operate on it.

  73. 73

    Which operation would retrieve PCs whose RAM is greater than the RAM of a laptop?

    1. A

      An equijoin requiring PC RAM to equal laptop RAM

    2. B

      A union requiring the PC and Laptop relations to have identical schemas

    3. C

      A theta join using the condition PC RAM greater than laptop RAM

    4. D

      A natural join requiring a same-named RAM attribute only

    Correct answer
    C

    A theta join using the condition PC RAM greater than laptop RAM

    Explanation

    A theta join supports comparison conditions such as greater than between attributes of two relations.

  74. 74

    Which operation would retrieve PCs and laptops having equal RAM values?

    1. A

      An equijoin using equality between PC RAM and laptop RAM

    2. B

      A division that removes the RAM attribute

    3. C

      A theta join using only a less-than condition

    4. D

      A set difference between the PC and Laptop relations

    Correct answer
    A

    An equijoin using equality between PC RAM and laptop RAM

    Explanation

    An equijoin is a theta join whose condition uses equality, such as PC RAM equals laptop RAM.

  75. 75

    Which operation would identify laptops associated with every PC RAM value in a divisor relation?

    1. A

      Set intersection

    2. B

      Outer union

    3. C

      Relational division

    4. D

      Unary selection

    Correct answer
    C

    Relational division

    Explanation

    Relational division identifies tuples associated with every tuple in the divisor relation.

Question 1 of 75
Question 1 of 75

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent