group function in sql
snippet in sql

sql group by

user7821

  SELECT column_name(s)
  FROM table_name
  WHERE condition
  GROUP BY column_name(s)
  HAVING condition
  ORDER BY column_name(s); 

sql how to use group by

user5731

SELECT column1, function_name(column2)
FROM table_name
WHERE condition
GROUP BY column1, column2
ORDER BY column1, column2;

function_name: Name of the function used for example, SUM() , AVG().
table_name: Name of the table.
condition: Condition used.

group by in mysql

user9965

SELECT Shippers.ShipperName, COUNT(Orders.OrderID) AS NumberOfOrders 
FROM Orders
LEFT JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID
GROUP BY ShipperName; 

group function in sql

user1099

--- GROUP FUNCTION | MULTI ROW FUNCTION | AGGREGATE FUNCTION 
--- COUNT , MAX , MIN , SUM , AVG

GROUPING Functions

user1810

-- It accepts a single column as a parameter and returns "1" 
-- if the column contains a null value generated  as part of a
-- subtotal by a ROLLUP or CUBE operation or "0" for any other value,
-- including stored null values

SELECT fact_1_id,
       fact_2_id,
       SUM(sales_value) AS sales_value,
       GROUPING(fact_1_id) AS f1g, 
       GROUPING(fact_2_id) AS f2g
FROM   dimension_tab
GROUP BY CUBE (fact_1_id, fact_2_id)
HAVING GROUPING(fact_1_id) = 1 OR GROUPING(fact_2_id) = 1
ORDER BY GROUPING(fact_1_id), GROUPING(fact_2_id);

GROUP BY

user1508

SELECT <field1, field2, field3…>
FROM <table1_name>
WHERE <condition/expression>
GROUP BY <field1, field2, field3…>