Standard SQL does not allow us to use alias in the GROUP BY clause, however, MySQL supports this. The following query extracts the year from the order date and counts the orders per year. The year is used as an alias of the expression YEAR(orderDate). We use the year alias in the GROUP BY clause. This query is illegal in standard SQL.