Which of the following relational algebra operators cannot be implemented…

20232024

Which of the following relational algebra operators cannot be implemented directly in SQL?

  1. A.

    Union

  2. B.

    Intersection

  3. C.

    Division

  4. D.

    Minus

Attempted by 5 students.

Show answer & explanation

Correct answer: C

Relational algebra's fundamental operators include Union, Set Difference, and Cartesian Product; Intersection and Division are additional operators built from these fundamentals. Standard SQL provides native keywords for the operators that map cleanly onto set operations on complete rows: UNION for union, INTERSECT for intersection, and EXCEPT (or MINUS in some dialects such as Oracle) for set difference. Division has no such native keyword because it does not correspond to a simple row-wise set operation; it asks for rows in one relation that are related to EVERY row of another relation, which SQL can only express through a compound, nested query.

Applying this to each option: UNION combines two result sets directly (SELECT ... UNION SELECT ...). INTERSECT directly returns the rows common to two result sets. EXCEPT / MINUS directly returns the rows present in one result set but not the other. Division, however, requires an explicit multi-step construction, because SQL has no DIVIDE keyword to invoke directly:

  1. Identify the dividend relation (the one with the extra attribute to keep) and the divisor relation (the set of values every kept row must be associated with).

  2. For each candidate value of the extra attribute, check that it is associated, in the dividend relation, with every value present in the divisor relation.

  3. Express that check in SQL using two nested NOT EXISTS subqueries: the outer NOT EXISTS finds a divisor row that has no matching pair in the dividend relation for the candidate value.

  4. Equivalently, GROUP BY the candidate attribute and use HAVING COUNT(DISTINCT ...) equal to the total count of rows in the divisor relation.

Checking standard SQL keyword references (ISO SQL, Oracle, PostgreSQL, MySQL) confirms that UNION, INTERSECT, and EXCEPT / MINUS all exist as reserved keywords, while no SQL dialect defines a DIVIDE or DIV set operator. This independently confirms that Division is the operator without a direct SQL command.

Division is therefore the relational algebra operator that cannot be implemented directly in SQL.

Explore the full course: Capgemini Preparation