title: SQL query (in SQL, relational algebra and tuple relational calculus)
body: <p>Im doing a test exam where I've gotten stuck on one particular query, in both its SQL code, relational algebra and tuple relational calculus.</p>
  
  <p>The query states:
  Find the (city,state) pairs which house a branch of every type which is listed in the <code>Branch</code>
  relation.</p>
  
  <p>Where <code>Branch</code> is:</p>
  
  <pre><code>Branch_ID (Primary key)
  Branch_City
  Branch_State
  Branch_Type
  </code></pre>
  
  <p>and City is:</p>
  
  <pre><code>City_Name (Primary key)
  State_Name (Primary key)
  Population
  </code></pre>
  
  <p>And <code>Branch_City</code> and <code>Branch_State</code> is a foreign key to <code>City_Name</code> and <code>State_Name</code> respectively.</p>
  
  <p>The "rules" are that aggregate functions, such as <code>COUNT</code>,<code>MAX</code> etc <em>may not</em> be used.</p>
  
  <p>The query must be "understood" by MySQL and PostgreSQL however functions like <code>EXCEPT</code>, <code>INTERSECT</code> available in PostgreSQL but not in MySQL can be used.</p>
  
  <p>No subqueries in the <code>FROM</code> clause</p>
  
  <p>As said, it would be greatly appreciated if answers could be provided for sQL, relational algebra and tuple relational calculus. Those questions has stalled me.</p>
  
  <p>Thanks in advance!</p>