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.