# Question: Let R A B and S A C and let r R and s S be 2

Let R = (A, B) and S = (A, C), and let r(R) and s(S) be relations. Write an expression in SQL for each of the queries below:

a. {< a > | ∃ b (< a, b >∈ r ∧ b = 17)}

b. {< a, b, c > | < a, b >∈ r ∧ < a, c >∈ s}

c. {< a > | ∃ c (< a, c >∈ s ∧ ∃b1, b2 (< a b1 > ∈ r ∧ < c, b2 > ∈ r ∧ b1 > b2))}

a. {< a > | ∃ b (< a, b >∈ r ∧ b = 17)}

b. {< a, b, c > | < a, b >∈ r ∧ < a, c >∈ s}

c. {< a > | ∃ c (< a, c >∈ s ∧ ∃b1, b2 (< a b1 > ∈ r ∧ < c, b2 > ∈ r ∧ b1 > b2))}

## Answer to relevant Questions

Show that, in SQL, < > all is identical to not in.SQL-92 provides an n-ary operation called coalesce, which is defined as follows: coalesce (A1,A2, . . . , An) returns the first nonnull Ai in the list A1,A2, . . .,An, and returns null if all of A1,A2, . . .,An are null. ...Consider the relational database of Figure where the primary keys are underlined. Give expressions in QBE for each of the following queries:a. Find all employees who earn more than the average salary of all employees of ...Complete the SQL DDL definition of the bank database of Figure to include the relations loan andborrower.Using the relations of our sample bank database, write an SQL expression to define the following views:a. A view containing the account numbers and customer names (but not the balances) for all accounts at the Deer Park ...Post your question