17 comments

[ 782 ms ] story [ 1589 ms ] thread
Also just let me reference the damn alias in a group by, FUCK
The problem with this and similar requests is that it would change the identifier scoping in incompatible ways and therefore potentially break a lot of existing SQL code.
Let me reference fields as I create them:

  select xxxxx as a
       , a * 2 as b
Snowflake has that, once you start using it, it's painful to go back.
BigQuery has that and I've been loving using it since they introduced it
SELECT * EXCEPT(col_name) next please.
That might be nice for manual experimentation, but for application use, this seems brittle compared to specifying the columns you really want to have and process.
This was also discussed at the last SQL WG meeting but was postponed for further refinement. But it’s likely to be added soon.
What's wrong with GROUP BY 1,2,3?
So, why not a SORT BY ALL or a GROUPSORT BY ALL, too? Not always what you want (e.g., when you're ranking on a summarized column), but it often alphabetic order on the GROUP BY columns is just what the doctor ordered! :-)
The working group also discussed ORDER BY ALL, but for some reason most participants really did not like it.
What? No! I want GROUP BY * and more importantly GROUP BY mytable.*
this seems to ignore the fact that you can group by a column that isn't in the select statement.

it's not something that i've found a particular use for, but it IS a thing you can do.

What about reusing a CTE? Let me import a CTE definition so that it can be used throughout my app, not just in the current context.