I'm trying to understand what condition can be placed after the having clause - it is usually a condition, that uses the functions from the select statement, but it also can contain a column, that is typed in the select statement.
Here's an example:
create table r(a int, b int, c int, d int, e int primary key)
select a, min(b), sum(c)
from r
where b > 5
group by a
having "condition"
which of the following can replace the "condition"
a) b = 5
b) a = sum(e)
c) min(b) >= 6
When I execute this in SQL, only a) doesn't work, but what's the logic behind it?