Any reason for GROUP BY clause without aggregation function?

后端 未结 5 1383
心在旅途
心在旅途 2020-12-06 09:19

I\'m (thoroughly) learning SQL at the moment and came across the GROUP BYclause.

GROUP BY aggregates or groups the resultset according to t

5条回答
  •  不思量自难忘°
    2020-12-06 10:22

    is the GROUP BY statement in any way useful without an accompanying aggregate function?

    Using DISTINCT would be a synonym in such a situation, but the reason you'd want/have to define a GROUP BY clause would be in order to be able to define HAVING clause details.

    If you need to define a HAVING clause, you have to define a GROUP BY - you can't do it in conjunction with DISTINCT.

提交回复
热议问题