Does the order of columns matter in a group by clause?

No, the order doesn't matter for the GROUP BY clause.

MySQL and SQLite are the only databases I'm aware of that allow you to select columns which are omitted from the group by (non-standard, not portable) but the order doesn't matter there either.


SQL is declarative.

In this case, you have told the optimiser how you want the data grouped and it works out how to do it.

It won't evaluate line by line (procedural) and look at one column first

The main place column order matters is for indexes. col1, col2 is not the same as col2, col1. At all.