Machine-translated by Google. Questions are authored in English.
Top

Discussion

The SQL keyword GROUP BY instructs the DBMS to group together those rows that have the same value in a column.

  • A.True
  • B.False

Answer: A

Correct answer: True

GROUP BY collects rows sharing the same value in the named column or columns into a single group, and the aggregate functions in the SELECT list are then computed once per group.

Two rules follow. Every column in the SELECT list must either appear in the GROUP BY or be inside an aggregate, since anything else has no single value per group. And filtering on the aggregates belongs in HAVING, which runs after the grouping, rather than in WHERE, which runs before it.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.