logo

Division Operator (÷)

The Division operator is a derived operator, not supported as a primitive operator.

It is used in queries that include the keywords "all" or "every," such as "at all," "for all," or "in all," "at every," "for every," or "in every." Examples:

Find the person who has an account in all the banks of a particular city.

Find sailors who have reserved all boats.

Find students who have registered for every course.

In all these queries, the description after the keyword "all" or "every" defines a set containing some elements, and the final result contains those records that satisfy these requirements.

Notation: A ÷ B or A/B,

where A and B are two relations.

Ex of Division Operator

Expressing A ÷ B Using Basic Operators

Division can be expressed in terms of Cross Product, Set-Difference, and Projection.

For A ÷ B, compute all x values that are not 'disqualified' by some y value in B.

An x value is disqualified if, by attaching a y value from B, we obtain an xy tuple that is not in A.

Expressing_A ÷ B

Example:

Let's consider two relations, A and B:

A: A relation with attributes (x, y)

B: A relation with attribute (y)

To compute A ÷ B:

1.Cross Product: Compute the cross product of A and B.

2.Set-Difference: Subtract the resulting tuples from A that do not match with the cross product.

3.Projection: Project the remaining tuples to get the required result.

1.Example_A ÷ B Ex: 2.Example_A ÷ B

Example Queries Using Division:

1.Find the person who has an account in all the banks of a particular city:

Relation A: (Person, Bank)

Relation B: (Bank)

Query: A ÷ B

2.Find sailors who have reserved all boats:

Relation A: (Sailor, Boat)

Relation B: (Boat)

Query: A ÷ B

3.Find employees who work on all projects of a company:

Relation A: (Employee, Project)

Relation B: (Project)

Query: A ÷ B

3.Find employees who work on all projects of a company:

Relation A: (Student, Course)

Relation B: (Course)

Query: A ÷ B

Next ❯ ❮ Previous
discription of faastop website
logo