Yapı bu şekilde;

group by;
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name;


order by;
SELECT column_name(s)
FROM table_name
ORDER BY column_name(s) ASC|DESC


Zaten bunlar internette mevcut şeyler...