Division operation is ideally suited to handle queries of the

Duration: 1 min

2014

Division operation is ideally suited to handle queries of the type :

  1. A.

    customers who have no account in any of the branches in Delhi.

  2. B.

    customers who have an account at all branches in Delhi.

  3. C.

    customers who have an account in atleast one branch in Delhi.

  4. D.

    customers who have only joint account in any one branch in Delhi

Attempted by 240 students.

Show answer & explanation

Correct answer: B

Key idea: Division finds entities that are related to every member of a specified set (a "for all" condition).

  1. Model the data: let Accounts(customer, branch) record which customer has an account at which branch.

  2. Let D be the set of branches located in Delhi (D = πbranch(Branches where city = 'Delhi')).

  3. Then Accounts ÷ D returns all customers who have an account at every branch in D, i.e., at all Delhi branches.

Therefore the query that asks for customers who have an account at all branches in Delhi is correctly answered by the division operation.

Why the other query types are not division-based:

  • Customers who have no account in any Delhi branch: this is a "none" or negation query, handled by set difference or an anti-join (subtract customers with any Delhi account from all customers).

  • Customers who have an account in at least one Delhi branch: this is an existence query (there exists), handled by selection and projection or a semijoin, not division.

  • Customers who have only a joint account in any one Delhi branch: this mixes attribute filtering and existence at a single branch; it requires selections on account type and existence checks, not division.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Dsssb Tgt Computer Science Paper 2