Given the relation Married that consists of tuples of the form a, b, where a is the husband and b is the wife, the relation Brother that has tuples of the form c, d , where c is the brother of d ,and the relation Sibling, which has tuples of the form e, f , where e and f are siblings, use SQL to de?ne the relation Brother-In-Law, where tuples have the form x , y with x being the brother-in-law of y. (Hint : This query can be represented as a union of three separate SQL queries. SQL provides the operator UNION to achieve this e?ect.)

What will be an ideal response?

The ?rst SQL query, below, describes the situation where someone is the brother of the wife and hence the brother-in-law of the husband. The second disjunct describes the situation where someone is the brother of the husband and hence the brother-in-law
of the wife. The third disjunct describes the situation where, someone is the husband and hence the brother-in-law of all the wife’s brothers and sisters.

```
(SELECT Brother.col1, Married.col1
FROM Married, Brother
WHERE Brother.col2 = Married.col2)
UNION
(SELECT Brother.col1, Married.col2
FROM Married, Brother
WHERE Brother.col2 = Married.col1)
UNION
(SELECT Married.col1, Sibling.col2
FROM Married, Sibling
WHERE Sibling.col1 = Married.col2)
```

Computer Science & Information Technology

You might also like to view...

Which of the following DHCP options is used to exclude IP addresses from being distributed to other computers?

A. Reservations B. Suffixes C. Leases D. Gateways

Computer Science & Information Technology

____________ means that an object has an identity that extends beyond one session.

a. Event handling b. Introspection c. Persistence d. None of the above

Computer Science & Information Technology