Declaring a Column Alias
You can declare an alias for any column in the select list of the Projection clause. The GROUP BY clause can reference the column by its alias. This temporary name is in scope only while the SELECT statement is executing.
If your alias is an SQL keyword of the
SELECT statement, use the AS column_alias keyword to clarify
the syntax. For example, to use FROM as a table alias, the AS keyword
must immediately precede the alias to avoid a syntax error. The following
statement uses AS with from as an alias:
SELECT status AS from FROM stock GROUP BY from;
The following equivalent queries declare pcol as an alias,
and use that alias in the GROUP BY clause:
SELECT pseudo_corinthian AS pcol FROM architecture GROUP BY pcol;
SELECTt pseudo_corinthian pcol FROM architecture GROUP BY pco1;