title: Relational algebra - what is the proper way to represent a 'having' clause?
body: <p>Yes, this is a homework question but the names have been changed to protect the innocent. Meaning, I am not asking the homework question itself, but rather a small part of it so I can understand the whole.</p>
  
  <p>Let's say you have a SQL query like this:</p>
  
  <p>--The query would list car prices that occur more than once.</p>
  
  <pre><code>select car_price from cars
  group by car_price
  having count (car_price) &gt; 1;
  </code></pre>
  
  <p>The general form of this in relational algebra is Y (gl, al) R
  Where Y is the greek symbol, GL is list of attributes to group, AL is list of aggregations</p>
  
  <p>So the relational algebra would look like: </p>
  
  <pre><code> Y (count(car_price)) cars
  </code></pre>
  
  <p>So, how is the "having" clause written in that statement? Is there a shorthand? If not, do I just need to select from that relation? Something like this maybe?</p>
  
  <pre><code>SELECT (count(car_price) &gt; 1) [Y (count(car_price)) cars]
  </code></pre>
  
  <p>I have searched the internet on this for hours and have found no examples of converting HAVING to relational algebra. Thanks for the help!</p>