The difference between where clause and having clause

HAVINGClause and the WHEREclause is very similar HAVINGclause support WHEREclause for all the operators and syntax, but there are a few differences between the two:

  • WHEREClause is used to filter the data row, while the HAVINGclause is mainly used to filter the packet, i.e. HAVINGclause to filter the data packets based on the value of the aggregate values rather than a specific row, primarily used to filter packets.
  • WHEREClauses cannot contain aggregate functions, HAVINGand conditions in clauses can contain aggregate functions.
  • HAVINGClauses are filtered after data grouping, WHEREclauses are filtered before data grouping. WHEREClause excluding lines contained in the packet, can affect HAVINGclause filters out packets based on these values.
Published 94 original articles · liked 0 · visits 722

Guess you like

Origin blog.csdn.net/qq_46578181/article/details/105422442