SQL Review Exercise 2


Exercise 2

Two queries are said to be equivalent if they give the same answer for every instance of the database. Consider the following database:

government(name, rank, salary)
politician(name, party, gender)
donation(name, organization, amount)

For each of the following five pairs of SQL queries, determine whether they are equivalent. If they are not, give a database instance as a counter-example. Otherwise, just state that they are equivalent.

  1.  

  2.  

  3.  
  4.  


  5.  


Updated : Feb 28, 2003