PageSourceSearch

https://postgresqltutorial.dev/_next/static/chunks/pages/postgresql-group-by.ja-JP-12dd9ebd5e2d18ae.js

js postgresqltutorial.dev collected 2026-10-08 16:56:56 UTC 59,938 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4418],{7696:function(s,e,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/postgresql-group-by.ja-JP",function(){return l(5333)}])},5333:function(s,e,l){"use strict";l.r(e),l.d(e,{__toc:function(){return t}});var r=l(5893),n=l(2673),o=l(9298),i=l(8426);l(9128);var c=l(2643);let t=[{depth:2,value:"GROUP BY句の概要",id:"group-by句の概要"},{depth:3,value:"基本構文",id:"基本構文"},{depth:2,value:"PostgreSQLでのGROUP BYの使用",id:"postgresqlでのgroup-byの使用"},{depth:3,value:"1. グループ内の行をカウントする",id:"1-グループ内の行をカウントする"},{depth:3,value:"2. 合計を計算する",id:"2-合計を計算する"},{depth:3,value:"3. 平均を計算する",id:"3-平均を計算する"},{depth:3,value:"4. 最大値および最小値を見つける",id:"4-最大値および最小値を見つける"},{depth:3,value:"5. 複数の列によるグループ化",id:"5-複数の列によるグループ化"},{depth:3,value:"6. HAVING句と共にGROUP BYを使用する",id:"6-having句と共にgroup-byを使用する"},{depth:3,value:"7. ORDER BYと共にGROUP BYを組み合わせる",id:"7-order-byと共にgroup-byを組み合わせる"},{depth:3,value:"8. データのグループ化とフィルタリング",id:"8-データのグループ化とフィルタリング"},{depth:3,value:"9. JOINを使用したGROUP BY",id:"9-joinを使用したgroup-by"},{depth:3,value:"10. 式を使用したグループ化",id:"10-式を使用したグループ化"},{depth:3,value:"11. DISTINCTをGROUP BYと共に使用する",id:"11-distinctをgroup-byと共に使用する"},{depth:3,value:"12. DATE関数を使用したグループ化",id:"12-date関数を使用したグループ化"},{depth:2,value:"結論",id:"結論"},{depth:2,value:"スキーマの初期化",id:"スキーマの初期化"}];function _createMdxContent(s){let e=Object.assign({h1:"h1",p:"p",strong:"strong",h2:"h2",code:"code",h3:"h3",pre:"pre",span:"span",ul:"ul",li:"li",a:"a",hr:"hr"},(0,c.a)(),s.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.h1,{children:"PostgreSQL GROUP BY: データの集約"}),"\n",(0,r.jsxs)(e.p,{children:["PostgreSQLチュートリアルシリーズへようこそ!このレッスンでは、",(0,r.jsx)(e.strong,{children:"GROUP BY"}),"句に焦点を当てます。これは、データを集約し、行のグループに対して計算を行うために不可欠です。GROUP BY句を効果的に使用することで、データから有益なサマリーを生成できるようになります。"]}),"\n",(0,r.jsx)(e.h2,{id:"group-by句の概要",children:"GROUP BY句の概要"}),"\n",(0,r.jsxs)(e.p,{children:["PostgreSQLの",(0,r.jsx)(e.strong,{children:"GROUP BY"}),"句は、",(0,r.jsx)(e.code,{children:"COUNT"}),"、",(0,r.jsx)(e.code,{children:"SUM"}),"、",(0,r.jsx)(e.code,{children:"AVG"}),"、",(0,r.jsx)(e.code,{children:"MAX"}),"、",(0,r.jsx)(e.code,{children:"MIN"}),"のような集約関数と一緒に使用され、指定された列で同じ値を持つ行をグループ化してサマリー行を生成します。データ分析やレポート作成の強力なツールとなります。"]}),"\n",(0,r.jsx)(e.h3,{id:"基本構文",children:"基本構文"}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" column1, aggregate_function(column2)"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" table_name"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" column1;"})]})]})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"SELECT"}),": 取得する列と集約関数を指定します。"]}),"\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"FROM"}),": クエリ対象のテーブルを指定します。"]}),"\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"GROUP BY"}),": 結果をグループ化する列を指定します。"]}),"\n"]}),"\n",(0,r.jsx)(e.h2,{id:"postgresqlでのgroup-byの使用",children:"PostgreSQLでのGROUP BYの使用"}),"\n",(0,r.jsx)(e.p,{children:"ライブラリおよび映画データベースを使用して、GROUP BY句のさまざまな使用方法を実際の例で見ていきましょう。"}),"\n",(0,r.jsx)(e.h3,{id:"1-グループ内の行をカウントする",children:"1. グループ内の行をカウントする"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者ごとに数えた本の数"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"COUNT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" book_count"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.a,{href:"#schema-initialization",children:"スキーマの初期化を見る"})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}
1),"でグループ化します。"]}),"\n",(0,r.jsx)(e.li,{children:"各著者についての本の数を数えます。"}),"\n",(0,r.jsxs)(e.li,{children:["結果は、それぞれの著者と彼らの",(0,r.jsx)(e.code,{children:"books"}),"テーブル内の本の数を示します。"]}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"2-合計を計算する",children:"2. 合計を計算する"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者ごとの総ページ数を計算する"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"SUM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(pages) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" total_pages"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}),"でグループ化します。"]}),"\n",(0,r.jsxs)(e.li,{children:["各著者の本について、",(0,r.jsx)(e.code,{children:"pages"}),"を合計します。"]}),"\n",(0,r.jsx)(e.li,{children:"結果は、各著者と彼らの本の総ページ数を示します。"}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"3-平均を計算する",children:"3. 平均を計算する"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者ごとの本の平均価格を求める"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"AVG"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(price) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" average_price"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}),"でグループ化します。"]}),"\n",(0,r.jsxs)(e.li,{children:["各著者の本について、",(0,r.jsx)(e.code,{children:"price"}),"の平均を計算します。"]}),"\n",(0,r.jsx)(e.li,{children:"結果は、それぞれの著者と彼らの本の平均価格を示します。"}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"4-最大値および最小値を見つける",children:"4. 最大値および最小値を見つける"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者ごとの最高価格と最低価格の本を見つける"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"MAX"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(price) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" max_price, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"MIN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(price) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" min_price"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}
1),"でグループ化します。"]}),"\n",(0,r.jsxs)(e.li,{children:["各著者の本について、最大(",(0,r.jsx)(e.code,{children:"MAX"}),")および最小(",(0,r.jsx)(e.code,{children:"MIN"}),")の",(0,r.jsx)(e.code,{children:"price"}),"を見つけます。"]}),"\n",(0,r.jsx)(e.li,{children:"結果は、それぞれの著者、彼らの最も高価な本、および最も安価な本を示します。"}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"5-複数の列によるグループ化",children:"5. 複数の列によるグループ化"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者と価格ごとの本の数を数える"})}),"\n",(0,r.jsx)(e.p,{children:"それぞれの著者が各価格帯で持っている本の数を確認したいとしましょう。"}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, price, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"COUNT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" book_count"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, price;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}),"と",(0,r.jsx)(e.code,{children:"price"}),"でグループ化します。"]}),"\n",(0,r.jsx)(e.li,{children:"各著者が各価格で持っている本の数を数えます。"}),"\n",(0,r.jsx)(e.li,{children:"結果は、著者と価格の組み合わせごとに、対応する本の数を示します。"}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"6-having句と共にgroup-byを使用する",children:"6. HAVING句と共にGROUP BYを使用する"}),"\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"HAVING"}),"句を使用すると、集約関数に基づいてグループをフィルタリングできます。"]}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 2冊以上の本を持つ著者を見つける"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"COUNT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" book_count"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"HAVING"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"COUNT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"1"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}
1),"でグループ化します。"]}),"\n",(0,r.jsx)(e.li,{children:"各著者についての本の数をカウントします。"}),"\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"HAVING"}),"句は、著者の中で2冊以上の本を持っている著者のみをフィルタリングします。"]}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"7-order-byと共にgroup-byを組み合わせる",children:"7. ORDER BYと共にGROUP BYを組み合わせる"}),"\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"ORDER BY"}),"を使用して、グループ化した結果を並び替えることができます。"]}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者と彼らの総ページ数を降順に並べてリストする"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"SUM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(pages) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" total_pages"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"ORDER BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" total_pages "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"DESC"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"author"}),"でグループ化します。"]}),"\n",(0,r.jsxs)(e.li,{children:["各著者の",(0,r.jsx)(e.code,{children:"pages"}),"を合計します。"]}),"\n",(0,r.jsxs)(e.li,{children:["結果を",(0,r.jsx)(e.code,{children:"total_pages"}),"で降順に並べ替えます。"]}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"8-データのグループ化とフィルタリング",children:"8. データのグループ化とフィルタリング"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 著者ごとに$10以上の本の平均価格を計算する"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"AVG"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(price) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" average_price"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"WHERE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" price "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:">"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"10"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"price > 10"}),"で本をフィルタリングします。"]}),"\n",(0,r.jsxs)(e.li,{children:["残った本を",(0,r.jsx)(e.code,{children:"author"}
1),"でグループ化します。"]}),"\n",(0,r.jsxs)(e.li,{children:["各著者の本について",(0,r.jsx)(e.code,{children:"price"}),"の平均を計算します。"]}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"9-joinを使用したgroup-by",children:"9. JOINを使用したGROUP BY"}),"\n",(0,r.jsx)(e.p,{children:"JOINを使用して、複数のテーブルからデータをグループ化できます。"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: authorsテーブルにある著者ごとの本の数を数える"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" a.name "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author_name, "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"COUNT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"(b.title) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" book_count"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" authors a"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"LEFT JOIN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books b "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"ON"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" a.name "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" b.author"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" a.name;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"authors"}),"と",(0,r.jsx)(e.code,{children:"books"}
1),"を",(0,r.jsx)(e.code,{children:"LEFT JOIN"}),"します。"]}),"\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"a.name"}),"(著者の名前)で結果をグループ化します。"]}),"\n",(0,r.jsx)(e.li,{children:"各著者について、本の数をカウントします(本がない著者も含む)。"}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"10-式を使用したグループ化",children:"10. 式を使用したグループ化"}),"\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"GROUP BY"}),"句で式を使用することが可能です。"]}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: 本を価格帯でグループ化する"})}),"\n",(0,r.jsx)(e.p,{children:"本を次の価格帯に分けてみましょう: $10未満、$10から$12、$12以上。"}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"CASE"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"WHEN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" price "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"<"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"10"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"THEN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Under $10'"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"WHEN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" price "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"BETWEEN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"10"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AND"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"12"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"THEN"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'$10 - $12'"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"        "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"ELSE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Over $12'"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"END"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" price_range,"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"COUNT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"*"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"AS"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" book_count"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" price_range;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"CASE"}),"式を使用して",(0,r.jsx)(e.code,{children:"price_range"}),"カテゴリを作成します。"]}),"\n",(0,r.jsxs)(e.li,{children:["本を",(0,r.jsx)(e.code,{children:"price_range"}
1),"でグループ化します。"]}),"\n",(0,r.jsx)(e.li,{children:"各価格帯で本の数をカウントします。"}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"11-distinctをgroup-byと共に使用する",children:"11. DISTINCTをGROUP BYと共に使用する"}),"\n",(0,r.jsxs)(e.p,{children:[(0,r.jsx)(e.code,{children:"GROUP BY"}),"はしばしば",(0,r.jsx)(e.code,{children:"DISTINCT"}),"の代わりに使用できますが、必要に応じて両方を使うこともあります。"]}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"例: booksテーブルから一意の著者をリストする"})}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT DISTINCT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books;"})]})]})}),"\n",(0,r.jsxs)(e.p,{children:["または",(0,r.jsx)(e.code,{children:"GROUP BY"}),"を使用して:"]}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"SELECT"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"FROM"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"GROUP BY"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" author;"})]})]})}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"説明:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:["両方のクエリは",(0,r.jsx)(e.code,{children:"books"}),"テーブルから一意の著者のリストを返します。"]}),"\n"]}),"\n",(0,r.jsx)(e.h3,{id:"12-date関数を使用したグループ化",children:"12. DATE関数を使用したグループ化"}),"\n",(0,r.jsxs)(e.p,{children:["日付情報がある場合、日付の部分でグループ化することができます。今回はスキーマに",(0,r.jsx)(e.code,{children:"publication_date"}),"列がないため、この例は省略します。"]}),"\n",(0,r.jsx)(e.h2,{id:"結論",children:"結論"}),"\n",(0,r.jsx)(e.p,{children:"PostgreSQLのGROUP BY句は、データを集約し要約するための強力なツールです。GROUP BY句と集約関数を習得することで、データから意味のあるインサイトを引き出すことができます。"}),"\n",(0,r.jsx)(e.p,{children:(0,r.jsx)(e.strong,{children:"重要なポイント:"})}),"\n",(0,r.jsxs)(e.ul,{children:["\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"GROUP BY"}),"を使用して、1つ以上の列で同じ値を持つ行をグループ化する。"]}),"\n",(0,r.jsxs)(e.li,{children:["集約関数(",(0,r.jsx)(e.code,{children:"COUNT"}),"、",(0,r.jsx)(e.code,{children:"SUM"}),"、",(0,r.jsx)(e.code,{children:"AVG"}),"、",(0,r.jsx)(e.code,{children:"MAX"}),"、",(0,r.jsx)(e.code,{children:"MIN"}),"など)によってグループ化されたデータに対して計算を行う。"]}),"\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"HAVING"}),"句を使用して、集約値に基づいてグループをフィルタリングする。"]}),"\n",(0,r.jsxs)(e.li,{children:[(0,r.jsx)(e.code,{children:"ORDER BY"}),"を組み合わせてグループ化した結果をソートする。"]}),"\n",(0,r.jsxs)(e.li,{children:["式でグループ化し、",(0,r.jsx)(e.code,{children:"CASE"}),"ステートメントを使ってカスタムグループ化を行うことができる。"]}),"\n"]}),"\n",(0,r.jsx)(e.hr,{}),"\n",(0,r.jsx)(e.h2,{id:"スキーマの初期化",children:"スキーマの初期化"}),"\n",(0,r.jsx)(e.p,{children:"以下のスキーマを使って、提供された例を実行するためのPostgreSQLデータベースをセットアップしましょう:"}),"\n",(0,r.jsx)(e.pre,{"data-language":"sql","data-theme":"default",children:(0,r.jsxs)(e.code,{"data-language":"sql","data-theme":"default",children:[(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- booksテーブルを作成"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"CREATE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"TABLE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"books"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ("})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    title "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VARCHAR"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"255"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    author "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VARCHAR"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"255"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    price "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"NUMERIC"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"10"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"2"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    pages "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"INTEGER"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:" "}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- booksテーブルにサンプルデータを挿入"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"INSERT INTO"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" books (title, author, price, pages) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VALUES"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'The Great Gatsby'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'F. Scott Fitzgerald'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"10"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"180"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'This Side of Paradise'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'F. Scott Fitzgerald'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"7"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"305"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'To Kill a Mockingbird'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Harper Lee'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"7"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"281"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Go Set a Watchman'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Harper Lee'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"8"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"278"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'1984'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'George Orwell'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"8"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"328"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Animal Farm'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'George Orwell'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"5"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"112"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Pride and Prejudice'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Jane Austen'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"6"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"279"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Sense and Sensibility'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Jane Austen'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"5"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"226"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'The Catcher in the Rye'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'J.D. Salinger'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"9"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"214"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Moby-Dick'"}),(0,r.jsx)(e.span,{style:{color:"var(--sh
1iki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Herman Melville'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"11"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"635"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'War and Peace'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Leo Tolstoy'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"12"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"."}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"99"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"1225"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:" "}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- authorsテーブルを作成"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"CREATE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"TABLE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"authors"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ("})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"name"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VARCHAR"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"255"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:" "}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- authorsテーブルにサンプルデータを挿入"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"INSERT INTO"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" authors ("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"name"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:") "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VALUES"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'F. Scott Fitzgerald'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Harper Lee'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'George Orwell'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Jane Austen'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'J.D. Salinger'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Herman Melville'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Leo Tolstoy'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Mark Twain'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");  "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- JOIN例用に本を持たない著者を追加"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:" "}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- moviesテーブルを作成"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"CREATE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"TABLE"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-function)"},children:"movies"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" ("})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"    title "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VARCHAR"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-constant)"},children:"255"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:")"})]}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})}),"\n",(0,r.jsx)(e.span,{className:"line",children:" "}),"\n",(0,r.jsx)(e.span,{className:"line",children:(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-comment)"},children:"-- moviesテーブルにサンプルデータを挿入"})}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"INSERT INTO"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:" movies (title) "}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-keyword)"},children:"VALUES"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'The Shawshank Redemption'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'The Godfather'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'The Dark Knight'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'Pulp Fiction'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"),"})]}),"\n",(0,r.jsxs)(e.span,{className:"line",children:[(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-token-string-expression)"},children:"'The Lord of the Rings'"}),(0,r.jsx)(e.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})]})})]})}let a={MDXContent:function(){let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:e}=Object.assign({},(0,c.a)(),s.components);return e?(0,r.jsx)(e,{...s,children:(0,r.jsx)(_createMdxContent,{...s})}):_createMdxContent(s)},pageOpts:{filePath:"pages/postgresql-group-by.ja-JP.mdx",route:"/postgresql-group-by",timestamp:1730457028e3,pageMap:[{kind:"Meta",locale:"ja-JP",data:{index:{title:"PostgreSQLとは?"},"postgresql-select":{title:"SELECT: データのクエリ"},"postgresql-where":{title:"WHERE: データのフィルタリング"},"postgresql-join":{title:"JOIN: テーブルデータの結合"},"postgresql-group-by":{title:"GROUP BY: データの集約"},"postgresql-insert":{title:"INSERT: 新しいデータの追加"},"postgresql-update":{title:"UPDATE: データの修正"}}},{kind:"MdxPage",name:"index",route:"/",locale:"ja-JP"},{kind:"MdxPage",name:"postgresql-group-by",route:"/postgresql-group-by",locale:"ja-JP"},{kind:"MdxPage",name:"postgresql-insert",route:"/postgresql-insert",locale:"ja-JP"},{kind:"MdxPage",name:"postgresql-join",route:"/postgresql-join",locale:"ja-JP"},{kind:"MdxPage",name:"postgresql-select",route:"/postgresql-select",locale:"ja-JP"},{kind:"MdxPage",name:"postgresql-update",route:"/postgresql-update",locale:"ja-JP"},{kind:"MdxPage",name:"postgresql-where",route:"/postgresql-where",locale:"ja-JP"}],flexsearch:{codeblocks:!0},title:"PostgreSQL GROUP BY: データの集約",headings:t},pageNextRoute:"/postgresql-group-by.ja-JP",nextraLayout:o.ZP,themeConfig:i.Z};e.default=(0,n.j)(a)},8426:function(s,e,l){"use strict";var r=l(5893);l(7294);let n={logo:(0,r.jsx)("span",{children:"PostgreSQL Tutorial"}),useNextSeoProps:()=>({titleTemplate:"%s – postgresqltutorial.dev"}),editLink:{text:null},toc:{extraContent:!1},feedback:{content:null},footer:{text:(0,r.jsxs)("span",{children:["\xa9"," ",(0,r.jsx)("a",{href:"https://postgresqltutorial.dev",children:"postgresqltutorial.dev"})]})},i18n:[{locale:"en-US",text:"\uD83C\uDDFA\uD83C\uDDF8 English"},{locale:"es-ES",text:"\uD83C\uDDEA\uD83C\uDDF8 Spanish"},{locale:"fr-FR",text:"\uD83C\uDDEB\uD83C\uDDF7 French"},{locale:"de-DE",text:"\uD83C\uDDE9\uD83C\uDDEA German"},{locale:"zh-CN",text:"\uD83C\uDDE8\uD83C\uDDF3 Chinese (Simplified)"},{locale:"pt-BR",text:"\uD83C\uDDE7\uD83C\uDDF7 Portuguese (Brazil)"},{locale:"nl-NL",text:"\uD83C\uDDF3\uD83C\uDDF1 Dutch"}
1,{locale:"ko-KR",text:"\uD83C\uDDF0\uD83C\uDDF7 Korean"},{locale:"tr-TR",text:"\uD83C\uDDF9\uD83C\uDDF7 Turkish"},{locale:"vi-VN",text:"\uD83C\uDDFB\uD83C\uDDF3 Vietnamese"},{locale:"it-IT",text:"\uD83C\uDDEE\uD83C\uDDF9 Italian"},{locale:"pl-PL",text:"\uD83C\uDDF5\uD83C\uDDF1 Polish"},{locale:"uk-UA",text:"\uD83C\uDDFA\uD83C\uDDE6 Ukrainian"},{locale:"ru-RU",text:"\uD83C\uDDF7\uD83C\uDDFA Russian"},{locale:"ja-JP",text:"\uD83C\uDDEF\uD83C\uDDF5 Japanese"},{locale:"hi-IN",text:"\uD83C\uDDEE\uD83C\uDDF3 Hindi"},{locale:"bn-IN",text:"\uD83C\uDDEE\uD83C\uDDF3 Bengali"},{locale:"ta-IN",text:"\uD83C\uDDEE\uD83C\uDDF3 Tamil"},{locale:"id-ID",text:"\uD83C\uDDEE\uD83C\uDDE9 Indonesian"},{locale:"th-TH",text:"\uD83C\uDDF9\uD83C\uDDED Thai"},{locale:"sv-SE",text:"\uD83C\uDDF8\uD83C\uDDEA Swedish"},{locale:"cs-CZ",text:"\uD83C\uDDE8\uD83C\uDDFF Czech"}]};e.Z=n}},function(s){s.O(0,[9774,2977,2888,179],function(){return s(s.s=7696)}),_N_E=s.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.