Where,group by,having Re-explanation
Where to use:
Where is used with in with, in (value 1, value 2, ...) ) indicates the result at value 1, value 2,。。。 Any one of them.
Aggregate functions and the use of GROUP by:
Aggregation function: In a select sentence with an aggregate function, it is meaningless to have other column names, which can be said to be wrong. Because the aggregation function asks
A whole, and the appearing of the stated is single.
(as you can see from here, KD876 is actually the name of Goods_id=1)
Gruop by and aggregation function, in order to show its power, the most important aggregation function has sum,avg,count,max,min,
They are often used with GROUP by: Select col_name, aggregate function from Tb_name GROUP by Col_name;
The aggregation function appears in this case to be useful, because the function here is to indicate the grouping.
Having usage: Where only works on the table structure, but having can work on the query results (the Select query still can be considered a table).
So where is called a query, having a filter.
MySQL Study notes Day eighth