Relational Algebra
- 75Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is relational algebra?
What is relational algebra?
75 questions
- 1
What is relational algebra?
- A
A storage format for unstructured multimedia files
- B
A programming language for defining operating systems
- C
A procedural data manipulation language for the relational model
- D
A graphical language for designing network topologies
Correct answer
CA 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.
- A
- 2
What does it mean that relational algebra is procedural?
- A
The user can modify only the physical storage location of data
- B
The database automatically chooses all operations without user input
- C
The user describes data values without specifying retrieval steps
- D
The user specifies the operations used to retrieve the expected data
Correct answer
DThe 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.
- A
- 3
What do relational algebra operations take as input and produce as output?
- A
Only individual attribute values as input and a scalar as output
- B
A query string as input and a physical disk page as output
- C
One or two relations as input and a new relation as output
- D
A complete database as input and a text file as output
Correct answer
COne 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.
- A
- 4
What forms a relational algebra expression?
- A
A list of database users and their permissions
- B
A single attribute value stored in a relation
- C
A physical index created for a database table
- D
Multiple relational algebra operations combined together
Correct answer
DMultiple relational algebra operations combined together
Explanation
Multiple relational algebra operations can be combined to form a relational algebra expression.
- A
- 5
In relational algebra, what are the operands?
- A
Comparison operators such as equals and less than
- B
Relations or variables that represent relations
- C
Physical files containing database backups
- D
Individual database domains without any relation
Correct answer
BRelations or variables that represent relations
Explanation
The operands in relational algebra are relations or variables representing relations.
- A
- 6
What is the role of an operator in relational algebra?
- A
It identifies the hardware device holding a relation
- B
It converts every relation into a single numerical value
- C
It maps relations to relations according to combination and evaluation rules
- D
It permanently changes the data type of every attribute
Correct answer
CIt 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.
- A
- 7
Which list correctly identifies the four categories of relational algebra operations presented?
- A
Sorting, indexing, storage, and security operations
- B
Text, numeric, logical, and physical operations
- C
Input, processing, output, and backup operations
- D
Set, unary, binary, and extended operations
Correct answer
DSet, unary, binary, and extended operations
Explanation
The four categories are set operations, unary operations, binary operations, and extended operations.
- A
- 8
What is a tuple in the relational model?
- A
A collection of relations stored in one database
- B
A field name used to identify a table
- C
An immutable ordered sequence of values representing a row
- D
A data type permitted for a particular attribute
Correct answer
CAn 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.
- A
- 9
What is a relation in a relational database?
- A
A comparison between two attribute values
- B
A permitted data type for one field
- C
A group of tuples equivalent to a table
- D
A single field inside a table
Correct answer
CA 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.
- A
- 10
What is an attribute?
- A
A field or column in a relation
- B
A sequence of operations in a query
- C
A complete collection of rows
- D
A data type shared by all relations
Correct answer
AA field or column in a relation
Explanation
An attribute is a field in a relation or table.
- A
- 11
What is a domain?
- A
The data type of values permitted for a particular attribute
- B
The set of operations applied to two relations
- C
The number of tuples contained in a relation
- D
The name assigned to a temporary query variable
Correct answer
AThe data type of values permitted for a particular attribute
Explanation
A domain specifies the data type of values permitted for a given attribute.
- A
- 12
When are two relations union-compatible?
- A
When they have the same number of tuples but different attributes
- B
When they contain at least one identical tuple regardless of degree
- C
When they have the same degree and corresponding attributes share the same domains
- D
When every attribute in one relation has a unique name
Correct answer
CWhen 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.
- A
- 13
Why are union, intersection, set difference, and Cartesian product classified as binary operations?
- A
Each operation returns exactly two attributes
- B
Each operation can be performed only twice
- C
Each operation requires two database users
- D
Each operation uses two relations as operands
Correct answer
DEach operation uses two relations as operands
Explanation
Set operations are binary because they operate on two relations.
- A
- 14
What is the result of the union of relations R and S?
- A
All tuples appearing in R or S, with duplicates removed
- B
Only tuples appearing in both R and S, with duplicates retained
- C
Every possible pairing of a tuple from R with one from S
- D
Tuples in R that do not appear anywhere in S
Correct answer
AAll tuples appearing in R or S, with duplicates removed
Explanation
Union combines the tuples from both relations and eliminates duplicates.
- A
- 15
What degree does the result of a valid union have?
- A
The sum of the degrees of the input relations
- B
The degree of only the first input relation
- C
The number of tuples in the second input relation
- D
The same degree as both input relations
Correct answer
DThe same degree as both input relations
Explanation
For union-compatible relations, the result has the same number of attributes as either input relation.
- A
- 16
A student attempts to union the Actors and Directors relations, but they are not union-compatible. What is the most appropriate solution?
- A
Apply Cartesian product and assume incompatible attributes will disappear
- B
Rename the entire database so all relations become compatible
- C
Project matching attributes from one relation before performing the union
- D
Use set difference because it does not require compatible relations
Correct answer
CProject 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.
- A
- 17
What does the intersection of relations R and S return?
- A
Tuples that occur in both R and S
- B
All tuples from R followed by all tuples from S
- C
Tuples that occur only in R
- D
Every possible pairing between R and S
Correct answer
ATuples that occur in both R and S
Explanation
Intersection returns the tuples shared by both relations, with duplicates removed.
- A
- 18
Which condition is required before performing an intersection?
- A
The two relations must contain completely different tuples
- B
The two relations must be union-compatible
- C
The two relations must have different degrees
- D
The two relations must have no common attribute names
Correct answer
BThe two relations must be union-compatible
Explanation
Like union, intersection requires the input relations to be union-compatible.
- A
- 19
If John Cena appears in both the Writers and Clients relations, what happens to John Cena in their intersection?
- A
John Cena appears only if he occurs twice in the first relation
- B
John Cena is placed in a separate difference relation
- C
John Cena appears in the intersection
- D
John Cena is removed because duplicates are forbidden
Correct answer
CJohn Cena appears in the intersection
Explanation
Intersection contains tuples present in both input relations, so John Cena appears in the result.
- A
- 20
What does the set difference R minus S return?
- A
Tuples in S that are not in R
- B
Tuples in R that are not in S
- C
Tuples that occur in both R and S
- D
All tuples from R and S combined
Correct answer
BTuples in R that are not in S
Explanation
Set difference returns tuples belonging to the first relation but not to the second.
- A
- 21
Why does the order of operands matter in set difference?
- A
The second relation determines the degree of the result
- B
R minus S and S minus R generally select different base relations
- C
Set difference automatically changes into intersection when reversed
- D
The first relation is always discarded after comparison
Correct answer
BR 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.
- A
- 22
If John Cena appears in both Writers and Clients, why is he excluded from Writers minus Clients?
- A
He is excluded because set difference removes every writer
- B
He is excluded because set difference returns only shared tuples
- C
He is excluded because the two relations have different degrees
- D
He is not exclusive to Writers because he also appears in Clients
Correct answer
DHe 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.
- A
- 23
What does the Cartesian product R cross S produce?
- A
Only tuples appearing in both R and S
- B
Only tuples that have equal values in corresponding attributes
- C
A concatenated tuple for every tuple in R paired with every tuple in S
- D
Tuples in R after removing attributes found in S
Correct answer
CA 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.
- A
- 24
If R has four attributes and S has four attributes, what is the degree of their Cartesian product?
- A
The number of attributes in R minus S
- B
Sixteen attributes
- C
Eight attributes
- D
Four attributes
Correct answer
CEight attributes
Explanation
The degree of a Cartesian product is the sum of the degrees of its inputs, so it is 4+4=8 attributes.
- A
- 25
If R contains m tuples and S contains n tuples, how many tuples can their Cartesian product contain?
- A
m tuples only
- B
m+n tuples
- C
m−n tuples
- D
m×n tuples
Correct answer
Dm×n tuples
Explanation
Each of the m tuples in R is paired with each of the n tuples in S, producing m×n pairings.
- A
- 26
Which statement about Cartesian product differs from the requirements for union and intersection?
- A
Its input relations must have identical domains
- B
Its input relations must contain matching tuples
- C
Its input relations must have the same degree
- D
Its input relations do not need to be union-compatible
Correct answer
DIts input relations do not need to be union-compatible
Explanation
Unlike union, intersection, and set difference, Cartesian product does not require union compatibility.
- A
- 27
What is the defining characteristic of a unary relational algebra operation?
- A
It takes one relation as input and returns one relation
- B
It takes two relations and returns a scalar value
- C
It takes two relations and always concatenates their tuples
- D
It takes one attribute and returns a complete database
Correct answer
AIt takes one relation as input and returns one relation
Explanation
Unary operations use a single relation as input and produce a relation as output.
- A
- 28
Which set correctly lists the four unary operations presented?
- A
Sum, average, count, and maximum
- B
Union, intersection, difference, and product
- C
Theta join, equijoin, natural join, and division
- D
Select, projection, rename, and assignment
Correct answer
DSelect, projection, rename, and assignment
Explanation
The four unary operations discussed are select, projection, rename, and assignment.
- A
- 29
What does the selection operation return?
- A
A new relation formed from every tuple pairing
- B
A subset of rows satisfying a selection condition
- C
A subset of columns without filtering any rows
- D
A single aggregate value from an entire relation
Correct answer
BA subset of rows satisfying a selection condition
Explanation
Selection filters tuples according to a condition and returns the qualifying rows.
- A
- 30
Why is selection called a horizontal filter?
- A
It selects some columns while discarding other columns
- B
It combines rows from two unrelated relations
- C
It selects some rows while discarding other rows
- D
It changes the order of attributes from left to right
Correct answer
CIt selects some rows while discarding other rows
Explanation
Selection filters rows, so it is described as a horizontal filter.
- A
- 31
Which condition could be used in a selection operation?
- A
A comparison involving operators such as equals, less than, AND, OR, or LIKE
- B
Only a list of attribute names separated by commas
- C
A requirement that every tuple be paired with every other tuple
- D
Only the name of a second relation
Correct answer
AA 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.
- A
- 32
Which selection retrieves movies released in 2003 with a rank greater than 7?
- A
A projection of year and rank from the Movies relation
- B
A condition requiring year equals 2003 AND rank greater than 7
- C
A condition requiring year greater than 2003 OR rank equals 7
- D
A Cartesian product of year and rank relations
Correct answer
BA 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.
- A
- 33
What does projection return?
- A
A relation containing every possible tuple pairing
- B
A relation containing only tuples that satisfy a condition
- C
A relation containing a selected subset of attributes
- D
A scalar containing the total of one attribute
Correct answer
CA relation containing a selected subset of attributes
Explanation
Projection selects columns or attributes from a relation.
- A
- 34
Why is projection called a vertical filter?
- A
It orders tuples according to an attribute
- B
It selects some columns while discarding other columns
- C
It selects some rows while discarding other rows
- D
It vertically concatenates two relations
Correct answer
BIt selects some columns while discarding other columns
Explanation
Projection filters attributes or columns, so it is described as a vertical filter.
- A
- 35
Which operation should be used to retrieve only the first names from the Actors relation?
- A
Selection using the first-name attribute
- B
Projection of the first-name attribute
- C
Cartesian product with the first-name attribute
- D
Division by the first-name attribute
Correct answer
BProjection of the first-name attribute
Explanation
Projection is used to retain selected attributes, such as first name, while discarding other columns.
- A
- 36
What can the rename operation change?
- A
Only the physical location of the relation
- B
The relation name, attribute names, or both
- C
Only the number of tuples in a relation
- D
Only the domains of all attributes
Correct answer
BThe relation name, attribute names, or both
Explanation
Rename can change the name of a relation, the names of its attributes, or both.
- A
- 37
What is the purpose of assignment in relational algebra?
- A
It stores an intermediate relation in a temporary variable for a sequential query
- B
It permanently changes the values stored in the original relation
- C
It removes all temporary results from a database
- D
It converts a relation into a domain definition
Correct answer
AIt 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.
- A
- 38
Which sequence best illustrates assignment in a complex query?
- A
Rename an attribute, convert it to a domain, then calculate a Cartesian product
- B
Project every relation, delete the result, then select the deleted tuples
- C
Select actors where gender is male, assign the result to MaleActors, then project from MaleActors
- D
Union two incompatible relations, assign a scalar, then divide by an attribute
Correct answer
CSelect 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.
- A
- 39
What is a binary relational algebra operation?
- A
An operation that combines two input relations into one output relation
- B
An operation that renames two attributes in one relation
- C
An operation that filters one relation using one condition
- D
An operation that returns only one aggregate value
Correct answer
AAn operation that combines two input relations into one output relation
Explanation
Binary operations combine two input relations and produce one output relation.
- A
- 40
Which list contains the four binary operations presented?
- A
Union, intersection, difference, and Cartesian product
- B
Selection, projection, rename, and assignment
- C
Theta join, equijoin, natural join, and division
- D
Generalized projection, aggregation, outer join, and outer union
Correct answer
CTheta join, equijoin, natural join, and division
Explanation
The binary operations discussed are theta join, equijoin, natural join, and division.
- A
- 41
What condition does a theta join use?
- A
A requirement that the two relations have the same degree
- B
No condition, because every possible pairing is always retained
- C
A specified comparison condition between attributes of two relations
- D
A requirement that all attributes have identical names
Correct answer
CA specified comparison condition between attributes of two relations
Explanation
A theta join, also called a conditional join, joins relations according to a comparison condition.
- A
- 42
How does an equijoin differ from a general theta join?
- A
An equijoin requires no condition between the relations
- B
An equijoin can operate on only one relation
- C
An equijoin uses only inequality as its join condition
- D
An equijoin uses only equality as its join condition
Correct answer
DAn equijoin uses only equality as its join condition
Explanation
An equijoin is a theta join restricted to the equivalence condition.
- A
- 43
What must be true for a natural join?
- A
The relations must have identical numbers of tuples
- B
The relations must have no attributes with matching names
- C
The relations must be union-compatible in every attribute
- D
The relations must share at least one attribute with the same name and domain
Correct answer
DThe 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.
- A
- 44
How does a natural join handle common attributes after matching tuples?
- A
It changes the common attribute into a temporary variable
- B
It duplicates every common attribute three times
- C
It removes all common attributes from the result
- D
It eliminates the duplicate copy of the common attribute
Correct answer
DIt eliminates the duplicate copy of the common attribute
Explanation
Natural join matches tuples on common attributes and eliminates the duplicate attribute in the result.
- A
- 45
Which operation would be most appropriate for joining Product and PC using their shared Model attribute without retaining two copies of Model?
- A
Unary selection
- B
Aggregation
- C
Natural join
- D
Set difference
Correct answer
CNatural join
Explanation
A natural join uses the common Model attribute for equality matching and removes the duplicate copy.
- A
- 46
What does relational division return?
- A
Tuples from the first relation associated with at least one tuple in the second relation
- B
Tuples from the first relation associated with every tuple in the second relation
- C
Only tuples that have unequal values in both relations
- D
All concatenated tuples from both input relations
Correct answer
BTuples 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.
- A
- 47
Which attributes are typically absent from the result of relational division?
- A
Every attribute that contains a numerical value
- B
All attributes from the second relation except the divisor
- C
The attributes used as the divisor or division-matching attributes
- D
All attributes from the first relation
Correct answer
CThe 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.
- A
- 48
Which statement best distinguishes generalized projection from ordinary projection?
- A
Generalized projection filters rows but cannot select columns
- B
Generalized projection permits arithmetic expressions in the projection list
- C
Generalized projection always requires two input relations
- D
Generalized projection returns only a single aggregate value
Correct answer
BGeneralized projection permits arithmetic expressions in the projection list
Explanation
Generalized projection extends projection by allowing arithmetic functions or expressions on attributes.
- A
- 49
A credit company wants to calculate credit consumed as credit limit minus credit balance for every customer. Which operation is appropriate?
- A
Set intersection
- B
Natural join
- C
Relational division
- D
Generalized projection
Correct answer
DGeneralized projection
Explanation
Generalized projection can calculate an expression such as credit limit minus credit balance and return it as a derived attribute.
- A
- 50
What do aggregate functions do?
- A
They combine two relations without comparing attributes
- B
They take a collection of values and return a single value
- C
They rename all attributes in a relation
- D
They take one tuple and return every tuple in a relation
Correct answer
BThey take a collection of values and return a single value
Explanation
Aggregate functions summarize a collection of values into one result.
- A
- 51
Which set contains only aggregate operations presented in the content?
- A
Select, project, rename, and assignment
- B
Sum, average, count, minimum, and maximum
- C
Equals, less than, greater than, and LIKE
- D
Union, intersection, difference, and product
Correct answer
BSum, average, count, minimum, and maximum
Explanation
The aggregate functions presented are sum, average, count, min, and max.
- A
- 52
In an aggregation query for total salary in each department, what is the department attribute used for?
- A
It is the temporary relation variable
- B
It is the grouping attribute
- C
It is the comparison operator
- D
It is the aggregate function
Correct answer
BIt is the grouping attribute
Explanation
Department identifies the groups, while sum of salary produces the aggregate value for each group.
- A
- 53
What happens when the grouping attributes are omitted from an aggregation?
- A
The aggregate can be applied without dividing the input into groups
- B
Every attribute becomes a grouping attribute
- C
The relation is automatically converted into a Cartesian product
- D
The aggregation becomes a selection condition
Correct answer
AThe 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.
- A
- 54
What is the main purpose of an outer join?
- A
To combine only relations with identical degrees
- B
To calculate an aggregate for each matching tuple
- C
To retain unmatched tuples and fill missing values with nulls
- D
To remove every tuple that lacks a matching tuple
Correct answer
CTo 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.
- A
- 55
What does a left outer join preserve?
- A
Only tuples that are absent from both relations
- B
All tuples from the right relation
- C
Only tuples from both relations that match
- D
All tuples from the left relation
Correct answer
DAll 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.
- A
- 56
What does a right outer join preserve?
- A
Only tuples with null values on the left
- B
Only tuples that match on both sides
- C
All tuples from the right relation
- D
All tuples from the left relation
Correct answer
CAll 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.
- A
- 57
What does a full outer join preserve?
- A
Only tuples from the relation named first
- B
All tuples from both relations, with nulls where matches are absent
- C
Only tuples whose join condition evaluates to true
- D
Only tuples containing common attributes
Correct answer
BAll 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.
- A
- 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?
- A
Number 4 exists in both relations but violates the join condition
- B
Number 4 exists in A but has no matching tuple in B
- C
The cube attribute is always null in a left outer join
- D
Number 4 exists only in B and is removed from the result
Correct answer
BNumber 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.
- A
- 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?
- A
Number 5 exists in A but not in B
- B
The square attribute is always null in a right outer join
- C
Right outer joins remove all unmatched B tuples
- D
Number 5 exists in B but has no matching tuple in A
Correct answer
DNumber 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.
- A
- 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?
- A
Only the number of matching photographers
- B
Three rows
- C
Seven rows
- D
Ten rows
Correct answer
CSeven 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.
- A
- 61
If two relations each contain three tuples and a full outer join produces six rows in the example, what does that indicate?
- A
The relations were first converted into union-compatible projections
- B
The join automatically performed aggregation on the six values
- C
The tuples from both relations are preserved, including unmatched tuples
- D
Only matching tuples were retained and each was duplicated
Correct answer
CThe 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.
- A
- 62
How does outer union extend ordinary union?
- A
It returns only tuples shared by both input relations
- B
It requires every attribute to have a different name and domain
- C
It combines common attributes even when noncommon attributes are not type-compatible
- D
It pairs every tuple in one relation with every tuple in the other
Correct answer
CIt 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.
- A
- 63
What happens to nonexisting data in an outer union result?
- A
The missing values are replaced by every value in the other relation
- B
The tuples containing missing data are always discarded
- C
Null values or type-appropriate default values are placed in the missing attributes
- D
The missing attributes are renamed to match the relation name
Correct answer
CNull 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.
- A
- 64
In the outer-union example, why can the increment column receive zero instead of null?
- A
Outer union always replaces every missing value with zero
- B
The column exists in both relations with identical values
- C
Its defined data type allows a type-appropriate default value
- D
The increment column is used as the join condition
Correct answer
CIts 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.
- A
- 65
How is outer union related to a full outer join?
- A
Outer union is equivalent to a selection on one relation
- B
Outer union is equivalent to a Cartesian product with no condition
- C
Outer union is equivalent to a left outer join using unrelated attributes
- D
Outer union is equivalent to a full outer join using common attributes
Correct answer
DOuter 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.
- A
- 66
Which operation should be used to find all actors whose names start with "Ch"?
- A
Selection using a pattern-matching condition such as LIKE
- B
Division by the Actors relation
- C
Projection of the first-name and last-name attributes
- D
Aggregation using count on the name attribute
Correct answer
ASelection 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.
- A
- 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?
- A
Select Stanley actors, project first and last names, then rename the attributes
- B
Perform a full outer join, select nulls, then union the result
- C
Project every attribute, divide by Stanley, then apply set difference
- D
Rename the relation, calculate an aggregate, then perform a Cartesian product
Correct answer
ASelect 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.
- A
- 68
How can the total cost of each laptop model after a delivery charge be obtained?
- A
Use intersection to retain only laptops with matching delivery charges
- B
Use division to remove the cost attribute from each laptop
- C
Use rename to calculate a new numerical value
- D
Use generalized projection to add the delivery charge to the laptop cost
Correct answer
DUse 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.
- A
- 69
Which relational algebra strategy retrieves employees using the Department relation while retaining employees without a department match?
- A
Use projection alone because projection matches department identifiers
- B
Use intersection because unmatched employees should be retained
- C
Use division because every employee must belong to every department
- D
Use an outer join involving the Employees and Department relations
Correct answer
DUse 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.
- A
- 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?
- A
Aggregation with count grouped by director
- B
Set difference between movies and directors
- C
Natural join without any selection condition
- D
Projection without grouping by director
Correct answer
AAggregation 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.
- A
- 71
Why might unary operations be performed before a set operation in a complex query?
- A
They automatically convert every binary operation into an aggregate
- B
They can filter or project relations so that the desired set operation becomes possible
- C
They prevent any relation from being used more than once
- D
They ensure that all tuples are duplicated before union
Correct answer
BThey 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.
- A
- 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?
- A
T stores the intermediate combined relation for the later selection
- B
T represents the comparison operator used by the selection
- C
T permanently replaces both original relations
- D
T contains only the attributes removed by projection
Correct answer
AT 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.
- A
- 73
Which operation would retrieve PCs whose RAM is greater than the RAM of a laptop?
- A
An equijoin requiring PC RAM to equal laptop RAM
- B
A union requiring the PC and Laptop relations to have identical schemas
- C
A theta join using the condition PC RAM greater than laptop RAM
- D
A natural join requiring a same-named RAM attribute only
Correct answer
CA 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.
- A
- 74
Which operation would retrieve PCs and laptops having equal RAM values?
- A
An equijoin using equality between PC RAM and laptop RAM
- B
A division that removes the RAM attribute
- C
A theta join using only a less-than condition
- D
A set difference between the PC and Laptop relations
Correct answer
AAn 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.
- A
- 75
Which operation would identify laptops associated with every PC RAM value in a divisor relation?
- A
Set intersection
- B
Outer union
- C
Relational division
- D
Unary selection
Correct answer
CRelational division
Explanation
Relational division identifies tuples associated with every tuple in the divisor relation.
- A

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