having和where有相似之处但也有区别,都是设定条件的语句。
在查询过程中,聚合语句(sum,min,max,avg,count),要比having子句有限执行。
在查询过程中,要先执行where ,在执行聚合语句(sum,min,max,avg,count)。
Having是先分组在进行筛选,而where是先筛选再进行分组。