Do column references have to follow the order the columns are listed in the
No, once you list the columns after the
SELECT, they can be referenced by the order they appeared, starting from
1 for the first listed column.
You are not limited to referencing them in the exact order they were listed, like
GROUP BY 1, 2, 3
You can freely use the references in any order, like you would normally without using references.
GROUP BY 3, 1, 2
However, when using references, it is important to always keep in mind what numbers referenced which column, as it can become confusing as you list more columns in the
SELECT. It is a convenient shortcut, but not necessarily always the best choice.