D
D
Dima Sokolov2017-06-03 22:28:37
SQL
Dima Sokolov, 2017-06-03 22:28:37

What is the meaning of GROUP BY?

When using SUM, it is always required to use GROUP BY, moreover, with the same fields as in SELECT. What is the meaning of this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
longclaps, 2017-06-03
@dimka11

Not always:
Read .

A
Andrey Golubkov, 2017-06-04
@Android97

Sum is an aggregating function.
There are also other functions: COUNT is valid.
Group by groups rows together according to some criteria.
Let's say we have a table
id name
We want to count the number of entities with the same names.
we do Group by name, with the aggregating function COUNT.

V
Vapaamies, 2017-06-04
@vapaamies

The group by clause defines a list fold rule , where the fold itself is an aggregate function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question