Upgrade to Pro — share decks privately, control downloads, hide ads and more …

なぜPostgreSQLのGROUP BY句にエイリアスが使えるのか?

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for yamatai12 yamatai12
January 31, 2026

なぜPostgreSQLのGROUP BY句にエイリアスが使えるのか?

本スライドは以下の記事から作成しました

https://qiita.com/yamatai12/items/bc87df974f682c5da4a7
PostgreSQLのGROUP BY句にエイリアスが使える理由について理解する

Avatar for yamatai12

yamatai12

January 31, 2026
Tweet

More Decks by yamatai12

Other Decks in Technology

Transcript

  1. SELECT文の内部的な実行順序 PostgreSQLは以下。 1. WITH内のSELECT 2. FROM 3. WHERE 4. GROUP

    BY 5. HAVING 6. SELECT 列に対する関数やDISTINCTなど 7. UNION、INTERSECT、EXCEPT 8. ORDER BY 9. LIMIT 5
  2. https://www.postgresql.org/docs/18/queries-table-expressions.html#QUERIES- GROUP:~:text=In strict SQL%2C GROUP BY can only group by

    columns of the source table but PostgreSQL extends this to also allow GROUP BY to group by columns in the select list. Grouping by value expressions instead of simple column names is also allowed. 16