{"id":709,"date":"2009-03-26T19:29:53","date_gmt":"2009-03-26T19:29:53","guid":{"rendered":"http:\/\/pchero21.com\/?p=709"},"modified":"2009-03-26T19:29:53","modified_gmt":"2009-03-26T19:29:53","slug":"%eb%8d%b0%ec%9d%b4%ed%84%b0-%ec%96%bb%ea%b8%b0-%ec%b2%ab%ea%b1%b8%ec%9d%8c%ec%9d%84-%eb%82%b4%eb%94%9b%eb%8b%a4","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=709","title":{"rendered":"\ub370\uc774\ud130 \uc5bb\uae30 \uccab\uac78\uc74c\uc744 \ub0b4\ub51b\ub2e4."},"content":{"rendered":"<p>&nbsp;\uc694\uc57d.<br \/>&nbsp;1. \ud14c\uc774\ube14\uc5d0 \uc800\uc7a5\ub41c \ubaa8\ub4e0 \ub370\uc774\ud130\ub97c \ubcf4\uace0\uc790 \ud569\ub2c8\ub2e4. SELECT\uc640 FROM\uc808\ub85c \ub9cc\ub4e4\uc5b4 \ubcf4\ub77c.<br \/>-&gt; SELECT \uce7c\ub7fc1, \uce7c\ub7fc2 FROM \ud14c\uc774\ube14<\/p>\n<p>&nbsp;2. \uc804\uccb4 \ub370\uc774\ud130 \uc911 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uac12\ub9cc \ubcf4\uace0 \uc2f6\uc2b5\ub2c8\ub2e4. WHERE \uc808\uc744 \uc774\uc6a9\ud574 \ubcf4\ub77c.<br \/>-&gt; WHERE \uce7c\ub7fc \uc870\uac74 \uac12<\/p>\n<p>&nbsp;3. \uc77c\uc815\ud55c \uae30\ubd84\uc5d0 \uc758\ud574 \uc815\ub82c\ub418\uc5b4 \ud45c\ud604\ud558\uba74 \ubcf4\ub2e4 \uc27d\uac8c \uacb0\uacfc\ub97c \uc77d\uc5b4 \ub4e4\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4. ORDER BY \uc808\uc744 \uc774\uc6a9\ud574 \ubcf4\ub77c.<br \/>-&gt; ORDER BY \uce7c\ub7fc [ASC|DESC]<\/p>\n<p>&nbsp;4. \uc624\ub298 \uac00\uc7a5 \ub9ce\uc740 \ub9e4\ucd9c\uc561\uc744 \uc62c\ub9b0 \uc81c\ud488\uc774 \uad81\uae08\ud558\uc138\uc694? GROUP BY\uac00 \uc5ec\ub7ec\ubd84\uc5d0\uac8c \uadf8 \ub2f5\uc744 \uc81c\uc2dc\ud574 \uc904 \uac83\uc784.<br \/>-&gt; GROUP BY<\/p>\n<p>&nbsp;5. GROUP BY \uc808\uc758 \uacb0\uacfc\ub85c\ubd80\ud130 \ud2b9\uc815 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uac12\uc744 \uc5bb\uace0\uc790 \ud55c\ub2e4\uba74 HAVING \uc808\uc744 \uc0ac\uc6a9\ud558\ub77c.<br \/>-&gt; HAVING \uce7c\ub7fc \uc5f0\uc0b0\uc790 \uac12<\/p>\n<p>====================================================<\/p>\n<p>&nbsp;SQL\uc740 \uc5ec\ub7ec\ubd84\uc774 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc640 \uc774\uc57c\uae30\ud560 \uc218 \uc788\ub294 \uc5b8\uc5b4\uc785\ub2c8\ub2e4. \uc5ec\ub7ec\ubd84\uc774 \ud55c\uad6d\uc5b4\ub97c \ud1b5\ud574 \uc0ac\ub78c\ub4e4\uacfc \uc758\uc0ac \ud45c\ud604\uc744 \uc8fc\uace0 \ubc1b\ub4ef\uc774 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0 \uc800\uc7a5\ub41c \ub370\uc774\ud130\ub97c \ucc98\ub9ac\ud558\uae30 \uc704\ud574\uc11c\ub3c4 \uc5b8\uc5b4\uac00 \ud544\uc694\ud558\uc9c0\uc694. \uc989 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc640\uc758 \uc18c\ud1b5\uc744 \uc704\ud574 \uc5ec\ub7ec\ubd84\uc774 \uc54c\uc544\ub450\uc5b4\uc57c \ud558\ub294 \uc5b8\uc5b4\uac00 \ubc14\ub85c SQL(Structured Query Language)\uc785\ub2c8\ub2e4.<\/p>\n<p>====================================================<\/p>\n<p>&nbsp;2.1 \ub0b4 \ub9d8\ub300\ub85c \ub370\uc774\ud130 \uc5bb\uae30 &#8211; SELECT<\/p>\n<p>&nbsp;1) SELECT\ub97c \uc774\uc6a9\ud55c \ub370\uc774\ud130 \uc870\ud68c<br \/>&nbsp;-&gt; \ud14c\uc774\ube14\uc758 \ub370\uc774\ud130\ub97c \uc870\ud68c\ud558\ub294 \uae30\ubcf8\uc801\uc778 SQL\ubb38\uc740 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<p>&nbsp;SELECT \uce7c\ub7fc \uc774\ub9841, \uce7c\ub7fc \uc774\ub9842<br \/>&nbsp;FROM \ud14c\uc774\ube14 \uc774\ub984;<\/p>\n<p>&nbsp;\uac04\ub2e8\ud55c SQL\ubb38\uc740 \uc704\uc640 \uac19\uc774 SELECT\uc640 FROM\uc808\ub85c \uad6c\uc131\ub418\uc5b4 \uc788\uc2b5\ub2c8\ub2e4. SELECT\uc808 \ub2e4\uc74c\uc5d0\ub294 \uce7c\ub7fc \uc774\ub984\uc774 \uc624\uba70, FROM\uc808 \ub2e4\uc74c\uc5d0\ub294 \ud14c\uc774\ube14\uc758 \uc774\ub984\uc774 \uc628\ub2e4.<\/p>\n<p>&nbsp;2) \ud2b9\uc815 \uce7c\ub7fc \uc120\ud0dd<br \/>&nbsp;-&gt; \ud2b9\uc815 \uce7c\ub7fc\uc744 \uc120\ud0dd\ud558\uace0\uc790 \ud55c\ub2e4\uba74 SELECT\uc808\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \uce7c\ub7fc\uc744 \uc9c0\uc815\ud574 \ub450\uba74 \ub429\ub2c8\ub2e4. \uccab \ubc88\uc9f8 \uceec\ub984\uc740 employee_id(\uc0ac\uc6d0\ubc88\ud638)\uc774\uba70, \ub450 \ubc88\uc9f8 \uce7c\ub7fc\uc740 last_name(\uc0ac\uc6d0\uc758 \uc774\ub984)\uc785\ub2c8\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name<br \/>&nbsp; 2&nbsp; FROM employees;<\/p>\n<p>&nbsp;<br \/>&nbsp;\uc774\uc0c1\uc5d0\uc11c SELECT\ubb38\uc740 SELECT \uba85\ub839\uc73c\ub85c \uc2dc\uc791\ud574\uc11c ;(\uc138\ubbf8\ucf5c\ub860)\uc73c\ub85c \uc885\ub8cc\ud558\uba70, SELECT\uc808\uacfc FROM\uc808\ub85c \uad6c\uc131\ub428\uc744 \uc54c \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br \/>&nbsp;\uadf8\ub7ec\ub098 \uc9c8\uc758 \uac00 \ud14c\uc774\ube14\uc5d0 \uc800\uc7a5\ub41c \uc804\uccb4 \ub370\uc774\ud130\ub97c \ubaa8\ub450 \ubcf4\uc5ec\uc900\ub2e4\uba74 \uc694\uc998\uacfc \uac19\uc740 \ub300\uc6a9\ub7c9\uc758 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294 \ud14c\uc774\ube14\uc5d0\uc11c\ub294 \uc758\ubbf8 \uc5c6\ub294 \uc9c8\uc758\uac00 \ub420 \uac83\uc785\ub2c8\ub2e4. \ub300\uc6a9\ub7c9\uc758 \ub370\uc774\ud130\uac00 \ud654\uba74\uc5d0 \ucd9c\ub825\ub418\ub294 \ubaa8\uc2b5\ub9cc\uc744 \ubcf4\uac8c \ub418\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4.<\/p>\n<p>====================================================<\/p>\n<p>&nbsp;2.2 WHERE\uc808<\/p>\n<p>&nbsp;1) WHERE\uc808\uc758 \uae30\ubcf8<br \/>&nbsp;-&gt; WHERE\uc808\uc740 \uc804\uccb4 \ub370\uc774\ud130 \uc911 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uac12\ub9cc \uc5bb\uc744 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4. WHERE\uc808\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \uc774\ub8e8\uc5b4 \uc9d1\ub2c8\ub2e4.<\/p>\n<p>&nbsp;WHERE \uce7c\ub7fc\uc774\ub984 \uc870\uac74 \uac12<\/p>\n<p>&nbsp;\uadf8\ub807\ub2e4\uba74, \uc55e\uc758 \uc0ac\uc6d0 \ud14c\uc774\ube14\uc5d0\uc11c \uc774\ub984\uc774 King\uc778 \uc0ac\uc6d0\uc758 \uc0ac\uc6d0\ubc88\ud638\uc640 \uc785\uc0ac\uc77c \uc815\ubcf4\ub97c \uc5bb\uc5b4\ubcf4\ub3c4\ub85d \ud558\uc8e0.<\/p>\n<p>SQL&gt; SELECT employee_id, hire_date<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE last_name=&#8217;King&#8217;;<\/p>\n<p>EMPLOYEE_ID HIRE_DATE<br \/>&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;<br \/>&nbsp; &nbsp; 156 30-JAN-96<br \/>&nbsp; &nbsp; 100 17-JUN-87<\/p>\n<p>&nbsp;WHERE\uc808\uc744 \ubcf4\uba74 last_name \uce7c\ub7fc\uc758 \uac12\uc774 &#8216;King&#8217;\uacfc \uc77c\uce58\ud558\ub294 \ud589\uc744 \ucc3e\uc2b5\ub2c8\ub2e4. \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \ud589\ub4e4 \uc911\uc5d0\uc11c \uc0ac\uc6d0\ubc88\ud638(employee_id)\uc640 \uc785\uc0ac\uc77c(hire_date)\uce7c\ub7fc\uc5d0 \ub300\ud55c \uac12\uc744 \ubc18\ud658\ud569\ub2c8\ub2e4. \uc5ec\uae30\uc11c \uc8fc\uc758\ud560 \uc810\uc740 \ud14c\uc774\ube14\uc5d0 \uc800\uc7a5\ub41c \ubb38\uc790 \ub370\uc774\ud130\uc5d0 \ub300\ud574\uc11c\ub294 \ub300\uc18c\ubb38\uc790\ub97c \uad6c\ubd84\ud55c\ub2e4\ub294 \uac83, \uadf8\ub9ac\uace0 \ubb38\uc790, \ub0a0\uc9dc \ub370\uc774\ud130\ub294 &#8216; (single quotation)\uc73c\ub85c \ubb36\uc5b4\uc11c \ud45c\ud604\ud574 \uc8fc\uc5b4\uc57c \ud55c\ub2e4\ub294 \uac83\uc785\ub2c8\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, hire_date<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE last_name = &#8216;king&#8217;;<\/p>\n<p>no rows selected<\/p>\n<p>&nbsp;2) AND\ub97c \uc774\uc6a9\ud55c \uc870\uac74\uc808 \uc791\uc131<br \/>-&gt; \uc804\uccb4 \uc0ac\uc6d0 \uc911 \uae09\uc5ec\uac00 $10,000 \uc774\uc0c1 $20,000 \uc774\ud558\uc778 \uc0ac\uc6d0\ub4e4\uc744 \uc5bb\uc5b4\ubcf4\ub294 \uc608\uc81c\uc785\ub2c8\ub2e4. \uc774 \uacbd\uc6b0 \ubb38\uc81c\ub97c \ub2e4\uc2dc \ud574\uc11d\ud558\uba74, \uc0ac\uc6d0\uc758 \uae09\uc5ec\ub294 $10,000 \uc774\uc0c1\uc774\uba74\uc11c, $20,000 \uc774\ud558\uc778 \uc870\uac74\uc744 \ubaa8\ub450 \ub9cc\uc871\ud574\uc57c \ud569\ub2c8\ub2e4. \uc774 \uacbd\uc6b0 \ub17c\ub9ac \uc5f0\uc0b0\uc790 AND\ub97c \uc0ac\uc6a9\ud574\uc11c \ub098\ud0c0\ub0bc \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE salary &gt;= 10000<br \/>&nbsp; 4&nbsp; AND salary &lt;= 20000;<\/p>\n<p>&nbsp;3) OR\ub97c \uc774\uc6a9\ud55c \uc870\uac74\uc808 \uc791\uc131<br \/>-&gt; \uadf8\ub807\ub2e4\uba74, \uc0ac\uc6d0\uac00 \uc9c1\ubb34\uac00 &#8216;FI_MGR&#8217;\uacfc &#8216;FI_ACCOUNT&#8217;\uc778 \uc0ac\uc6d0\ub4e4\uc758 \ubaa9\ub85d\uc744 \uc5bb\uc73c\ub824\uba74 \uc5b4\ub5bb\uac8c \ud574\uc57c \ud560\uae4c\uc694. \uc989 \uc0ac\uc6d0\uc758 \uc9c1\ubb34\uac00 &#8216;FI_MGR&#8217;\uacfc &#8216;FI_ACCOUNT&#8217;\uc911 \ud558\ub098\ub77c\ub3c4 \ub9cc\uc871\ud558\ub294 \uc0ac\uc6d0\ub4e4\uc744 \ubaa8\ub450 \ud3ec\ud568\ud558\ub294 \uacb0\uacfc\ub97c \uc608\uc0c1\ud560 \uc218 \uc788\uaca0\uc9c0\uc694.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE job_id = &#8216;FI_MGR&#8217;<br \/>&nbsp; 4&nbsp; OR job_id = &#8216;FI_ACCOUNT&#8217;;<\/p>\n<p>EMPLOYEE_ID LAST_NAME &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SALARY<br \/>&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br \/>&nbsp; &nbsp; 109 Faviet &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9000<br \/>&nbsp; &nbsp; 110 Chen &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8200<br \/>&nbsp; &nbsp; 111 Sciarra &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7700<br \/>&nbsp; &nbsp; 112 Urman &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 7800<br \/>&nbsp; &nbsp; 113 Popp &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6900<br \/>&nbsp; &nbsp; 108 Greenberg &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 12000<\/p>\n<p>6 rows selected.<\/p>\n<p>&nbsp;4) BETWEEN AND\ub97c \uc774\uc6a9\ud55c \uc870\uac74\uc808 \uc791\uc131<br \/>&nbsp;-&gt; \ubc94\uc704\ub97c \uc9c0\uc815\ud560 \ub54c\ub294 BETWEEN AND \uc870\uac74\uc744 \uad8c\uc7a5\ud569\ub2c8\ub2e4. \ubcf4\ub2e4 \uac04\uacb0\ud558\uac8c \ud45c\ud604\ub418\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4. \uc774\ub294 \ubcf5\uc7a1\ud55c \uc9c8\uc758\ubb38\uc5d0\uc11c WHERE \uc870\uac74\uc808\uc744 \ubcf4\ub2e4 \ubd84\uba85\ud788 \ub098\ud0c0\ub0bc \uc218 \uc788\ub294 \uc7a5\uc810\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uadf8\ub7ec\ub098 $10,000\uc744 \ucd08\uacfc\ud558\uac70\ub098 $20,000 \ubbf8\ub9cc\uc77c \ub54c\ub294 &gt; (\ud06c\uac70\ub098), &lt; (\uc791\uc740) \uc640 \uac19\uc774 \ube44\uad50\ud574\uc57c\uaca0\uc9c0\uc694.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE salary BETWEEN 10000 AND 20000;<\/p>\n<p>&nbsp;5) IN\uc744 \uc774\uc6a9\ud55c \uc870\uac74\uc808 \uc791\uc131<br \/>&nbsp;-&gt; \ub9cc\uc57d \uc6d0\ud558\ub294 \uc9c1\ubb34\uac00 \ub354 \ucd94\uac00\ub418\ub294 \uacbd\uc6b0\ub294?<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, job_id<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE job_id = &#8216;FI_MGR&#8217;<br \/>&nbsp; 4&nbsp; OR job_id = &#8216;FI_ACCOUNT&#8217;<br \/>&nbsp; 5&nbsp; OR job_id = &#8216;SA_MGR&#8217;<br \/>&nbsp; 6&nbsp; OR job_id = &#8216;SA_REP&#8217;;<\/p>\n<p>&nbsp;\uc774 \uacbd\uc6b0 IN \uc870\uac74\uc744 \ud1b5\ud574 SQL \ubb38\uc7a5\uc744 \uac04\uacb0\ud558\uac8c \ub098\ud0c0\ub0bc \uc218 \uc788\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, job_id<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE job_id IN (&#8216;FI_MGR&#8217;, &#8216;FI_ACCOUNT&#8217;, &#8216;SA_MGR&#8217;, &#8216;SA_REP&#8217;);<\/p>\n<p>&nbsp;6) IS NULL\/NOT \uc744 \uc774\uc6a9\ud55c \uc870\uac74\uc808 \uc791\uc131<br \/>&nbsp;-&gt; \uc9c8\uc758\ubb38\uc774 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uacb0\uacfc\ub97c \uc791\uc131\ud574 \ubcf4\uc558\ub294\ub370 \uadf8\ub807\uc9c0 \uc54a\uc740 \uacbd\uc6b0\ub3c4 \uc0dd\uac01\ud574 \ubcfc \uc218 \uc788\uc744 \uac83\uc774\ub2e4. <\/p>\n<p>SQL&gt; SELECT employee_id, last_name, salary, commission_pct<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE commission_pct IS NOT NULL;<\/p>\n<p>&nbsp;NULL\uc774 \ud560\ub2f9\ub418\uc9c0 \uc54a\uc740 \uac12\uc774\ubbc0\ub85c \uc774\uc5d0 \ub300\ud55c \ubd80\uc815\uc73c\ub85c NULL \uc55e\uc5d0 NOT\uc744 \ubd99\uc5ec \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4. \ubd80\uc815\uc740 \uc774\uc640 \uac19\uc774 \uc870\uac74\uc758 \uc55e\uc5d0 \ubd99\uc5ec \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294\ub370, NOT BETWEEN AND\ub098 NOT IN\uacfc \uac19\uc774 \uc0ac\uc6a9\ud558\uba70, \uc218\uc2dd\uc5d0\uc11c\ub294 &#8216;!=&#8217; (\uac19\uc9c0\uc54a\uc74c)\uc758 \uc758\ubbf8\uac00 \uc788\ub2e4.<\/p>\n<p>&nbsp;7) LIKE\ub97c \uc774\uc6a9\ud55c \uc870\uac74\uc808 \uc791\uc131<br \/>&nbsp;-&gt; 1997\ub144\uc5d0 \uc785\uc0ac\ud55c \uc0ac\uc6d0\ub4e4\uc758 \ub9ac\uc2a4\ud2b8 \uc5bb\uae30.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, hire_date<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE hire_date BETWEEN &#8217;01\/Feb\/97&#8242; AND &#8217;31\/Dec\/97&#8242;;<\/p>\n<p>&nbsp;\uc774 \uc9c8\uc758\ubb38\uc740 \ub2e4\uc74c\uacfc \uac19\uc774 \uc791\uc131\ub420 \uc218\ub3c4 \uc788\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, hire_date<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE hire_date LIKE &#8216;%97&#8217;;<\/p>\n<p>&nbsp;&#8216;%97&#8217; \uc758 \uc758\ubbf8\ub294 97\ub85c \ub05d\ub098\ub294 \ubaa8\ub4e0 \uac12\uc740 \uc870\uac74\uc744 \ub9cc\uc871\ud568\uc744 \ub098\ud0c0\ub0b4\uba70, LIKE \uc870\uac74\uacfc \ud568\uaed8 \uc0ac\uc6a9\ub41c\ub2e4. \ud639 \uc5ec\ub7ec\ubd84\uc774 \uc800\uc7a5\ub41c \uac12\uc758 \uc77c\ubd80\ub9cc\uc744 \uae30\uc5b5\ud558\uace0 \uc788\uc744 \ub54c\uc5d0\ub3c4 LIKE\ub294 \uc720\uc6a9\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4.<\/p>\n<p>&nbsp;LIKE \uc808\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc640\uc77c\ub4dc \uce74\ub4dc \ubc0f ESCAPE \uc635\uc158<br \/>&nbsp;-&gt; \uc55e\uc5d0\uc11c \uc0ac\uc6a9\ud55c &#8216;%&#8217;\ub294 0~n \uac1c\uc758 \ubb38\uc790\uc5f4\uc744 \ub300\uccb4\ud55c\ub2e4. \uc774\uc678\uc5d0\ub3c4 \ub2e8 \ud558\ub098\uc758 \uae00\uc790\ub9cc\uc744 \ub300\uccb4\ud558\ub294 &#8216;_&#8217; \uc640\uc77c\ub4dc \uce74\ub4dc\ub3c4 \uc788\ub2e4.<br \/>&nbsp;\uadf8\ub7ec\uba74 %\ub098 _\uac00 \ud3ec\ud568\ub41c \ubb38\uc790\uc5f4\uc744 \uac80\uc0c9\ud558\uace0\uc790 \ud560 \ub54c\ub294 \uc5b4\ub5bb\uac8c \ud574\uc57c \ud560\uae4c. \uc774\ub54c\ub294 ESCAPE \uc635\uc158\uc744 \uc0ac\uc6a9\ud558\uc5ec ESCAPE \ubb38\uc790\ub97c \uc9c0\uc815\ud55c \ud6c4 ESCAPE \ubb38\uc790\ub97c \uc774\uc6a9\ud558\uc5ec %\ub098 _\ub97c \uc640\uc77c\ub4dc \uce74\ub4dc\uac00 \uc544\ub2cc \ud558\ub098\uc758 \ubb38\uc790\ub97c \uc778\uc2dd\ud558\ub3c4\ub85d \ud560 \uc218 \uc788\ub2e4. \ub2e4\uc74c\uc740 last_name\uc5d0 &#8216;Au%&#8217;\ub85c \uc2dc\uc791\ud558\ub294 \ubb38\uc790\uc5f4\uc744 \uac80\uc0c9\ud558\ub294 \uc608\uc81c\uc774\ub2e4.<\/p>\n<p>&nbsp;SQL&gt; SELECT employee_id, last_name<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE last_name LIKE &#8216;Au%%&#8217; ESCAPE &#8221;;<\/p>\n<p>&nbsp;\ucc38\uace0\ub85c \uc5f0\ub3c4\ub97c \uc774\uc6a9\ud558\uc5ec \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uac12\uc744 \ucc3e\uc744 \ub54c\ub294 \uc815\ud655\ud788 4\uc790\ub9ac\ub85c \ud45c\ud604\ud558\ub294 \uac83\uc774 \ubc14\ub78c\uc9c1\ud558\ub2e4. \uc55e\uc11c \uc5f0\ub3c4 4\uc790\ub9ac \uc911 \ub4a4 2\uc790\ub9ac\ub9cc \ub098\ud0c0\ub0b8\ub2e4\uba74 1990\ub144\uacfc 2090\ub144\uc758 \uad6c\ubd84\uc774 \uc758\ubbf8\uac00 \uc5c6\uc5b4\uc9c0\uae30 \ub54c\ubb38\uc774\ub2e4.<\/p>\n<p>&nbsp;\uc544\ub798\uc758 \uc9c8\uc758\ubb38\uc740 \ud568\uc218\ub97c \uc774\uc6a9\ud558\uc5ec \ub354\uc6b1 \uba85\ud655\ud55c \uc9c8\uc758\ubb38\uc744 \uc791\uc131\ud574 \ubcf8 \uc608\uc774\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, hire_date<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE TO_CHAR(hire_date, &#8216;YYYY&#8217;) = &#8216;1997&#8217;;<\/p>\n<p>&nbsp;8) \uc5f0\uc0b0\uc790 \uc815\ub9ac<br \/>&nbsp;= : \ub3d9\uc77c\ud568(\uac19\uc74c)\uc744 \ud14c\uc2a4\ud2b8\ud55c\ub2e4.<\/p>\n<p>&nbsp;!=, &lt;&gt;, ^= : \ub3d9\uc77c\ud558\uc9c0 \uc54a\uc74c(\uac19\uc9c0 \uc54a\uc74c)\uc744 \ud14c\uc2a4\ud2b8\ud55c\ub2e4.<\/p>\n<p>&nbsp;&gt;=, &gt;, &lt;=, &lt; : \ud070 \uacbd\uc6b0 \ud639\uc740 \ud06c\uac70\ub098 \uac19\uc740 \uacbd\uc6b0\uc758 \ube44\uad50 \ud14c\uc2a4\ud2b8\ub97c \ud55c\ub2e4. \uc774\uc640 \ubc18\ub300\uc758 \uacbd\uc6b0\ub3c4 \uc801\uc6a9\ub41c\ub2e4.<\/p>\n<p>&nbsp;AND : &#8216;A AND B&#8217;\uc758 \uacbd\uc6b0 \ub450 \uc870\uac74 \ubaa8\ub450\ub97c \ub9cc\uc871\ud574\uc57c \ud55c\ub2e4.<\/p>\n<p>&nbsp;OR : &#8216;A OR B&#8217;\uc758 \uacbd\uc6b0 \ub450 \uc870\uac74 \uc911 \ud558\ub098\ub97c \ub9cc\uc871\ud558\ub294 \uacbd\uc6b0\uc774\ub2e4.<\/p>\n<p>&nbsp;BETWEEN AND : \uc8fc\uc5b4\uc9c4 \ubc94\uc704\uc758 \uac12\uc5d0 \ud574\ub2f9\ud558\uba74 \uadf8 \uac12\uc744 \ubc18\ud658\ud55c\ub2e4.<\/p>\n<p>&nbsp;IN : \ud558\ub098 \uc774\uc0c1\uc758 \ub3d9\uc77c \uc870\uac74\uc744 \ub9cc\uc871\ud574\uc57c \ud558\ub294 \uacbd\uc6b0\uc774\ub2e4.<\/p>\n<p>&nbsp;LIKE : \uc870\uac74\uc758 \uc77c\ubd80\uc640 \uc77c\uce58\ud558\ub294 \uacbd\uc6b0\uc5d0 \uc801\uc6a9\ub41c\ub2e4.<\/p>\n<p>&nbsp;IS NULL \/ IS NOT NULL : \ud560\ub2f9\ub418\uc9c0 \uc54a\uc740 \uac12\uc744 \ub9cc\uc871\ud558\ub294 \uacbd\uc6b0\uc774\ub2e4. \ud560\ub2f9\ub41c \uac12\uc758 \uacbd\uc6b0 NULL \uc55e\uc5d0 NOT\uc744 \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n<p>====================================================<\/p>\n<p>&nbsp;2.3 ORDER BY<\/p>\n<p>&nbsp;1) ORDER BY ASC<br \/>&nbsp;-&gt; \ub54c\ub85c\ub294 \ub370\uc774\ud130\ub97c \uc77c\uc815\ud55c \uae30\uc900\uc5d0 \uc758\ud558\uc5ec \uc815\ub82c\ud558\uc5ec \ud45c\ud604\ud558\uba74 \ub354\uc6b1 \uc27d\uac8c \uacb0\uacfc\ub97c \uc77d\uc5b4\ub4e4\uc77c \uc218 \uc788\ub294\ub370 ORDER BY \uc808\uc744 \uc774\uc6a9\ud558\uba74 \uac00\ub2a5\ud558\ub2e4.<\/p>\n<p>&nbsp;ORDER BY \uce7c\ub7fc\uc774\ub984 [ASC\/DESC]<\/p>\n<p>&nbsp;\uce7c\ub7fc \uc774\ub984 \ub4a4 \ub300\uad04\ud638([ ])\ub294 \uc120\ud0dd\uc0ac\ud56d\uc774\uba70, \uae30\ubcf8\uc740 \uc624\ub984\ucc28\uc21c \uc815\ub82c\uc778 &#8216;ASC&#8217;\uc774\ub2e4. &#8216;ASC&#8217;\ub294 &#8216;Ascend(\uc62c\ub77c\uac00\ub2e4)&#8217;\uc758 \uc57d\uc790\uc774\ubbc0\ub85c, \uc791\uc740 \uac12\ubd80\ud130 \ud070 \uac12\uc758 \uc21c\uc11c\ub85c \uc815\ub82c\ub41c \uacb0\uacfc\ub97c \ubcf4\uc5ec\uc900\ub2e4. \ucc38\uace0\ub85c &#8216;DESC&#8217;\ub294 &#8216;Descend(\ub0b4\ub824\uac00\ub2e4)&#8217;\uc758 \uc57d\uc790\uc774\ub2e4.<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE salary &gt;= 10000<br \/>&nbsp; 4&nbsp; ORDER BY salary;<\/p>\n<p>&nbsp;ORDER BY\ub294 WHERE \uc870\uac74\uc808\uc744 \ub9cc\uc871\ud558\ub294 \uacb0\uacfc\ub85c\ubd80\ud130 \ud2b9\uc815 \uce7c\ub7fc\uc758 \uac12\uc744 \uae30\uc900\uc73c\ub85c \uc815\ub82c\ud55c \uacb0\uacfc\ub97c \ubcf4\ub0b4\uc900\ub2e4. WHERE \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uacb0\uacfc\ub97c \uba3c\uc800 \uc5bb\uc740 \ud6c4, \uadf8 \uacb0\uacfc\ub85c\ubd80\ud130 \ud2b9\uc815 \uce7c\ub7fc(salary)\uc744 \uae30\uc900\uc73c\ub85c \uc815\ub82c\ud558\uc5ec \ucd5c\uc885 \uacb0\uacfc\ub97c \ubcf4\uc5ec\uc900\ub2e4.<\/p>\n<p>&nbsp;2) ORDER BY DESC<\/p>\n<p>SQL&gt; SELECT employee_id, last_name, hire_date<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE hire_date &gt;= &#8217;01\/Jan\/00&#8242;<br \/>&nbsp; 4&nbsp; ORDER BY hire_date DESC;<\/p>\n<p>EMPLOYEE_ID LAST_NAME &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HIRE_DATE<br \/>&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;<br \/>&nbsp; &nbsp; 173 Kumar &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 21-APR-00<br \/>&nbsp; &nbsp; 167 Banda &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 21-APR-00<br \/>&nbsp; &nbsp; 166 Ande &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24-MAR-00<br \/>&nbsp; &nbsp; 128 Markle &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 08-MAR-00<br \/>&nbsp; &nbsp; 165 Lee &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 23-FEB-00<br \/>&nbsp; &nbsp; 136 Philtanker &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 06-FEB-00<br \/>&nbsp; &nbsp; 183 Geoni &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 03-FEB-00<br \/>&nbsp; &nbsp; 149 Zlotkey &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 29-JAN-00<br \/>&nbsp; &nbsp; 164 Marvins &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24-JAN-00<br \/>&nbsp; &nbsp; 199 Grant &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13-JAN-00<br \/>&nbsp; &nbsp; 179 Johnson &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 04-JAN-00<\/p>\n<p>11 rows selected.<\/p>\n<p>&nbsp;\ub0b4\ub9bc\ucc28\uc21c\uc740 DESC(Descending) \ud0a4\uc6cc\ub4dc\ub97c \uba85\uc2dc\uc801\uc73c\ub85c ORDER BY \uc808\uc5d0\uc11c \ub098\ud0c0\ub0b4 \uc8fc\uc5b4\uc57c \ud55c\ub2e4. <\/p>\n<p>====================================================<\/p>\n<p>&nbsp;2.4 GROUP BY<\/p>\n<p>&nbsp;1) GROUP BY\ub97c \uc774\uc6a9\ud55c \uadf8\ub8f9\ud654<br \/>&nbsp;-&gt; SQL\uc5d0\uc11c\ub294 GROUP BY \uc808\uacfc \uc9d1\ud569 \ud568\uc218\ub97c \uc774\uc6a9\ud568\uc73c\ub85c\uc368 \ub370\uc774\ud130\ub97c \ud65c\uc6a9\ud560 \uc218 \uc788\ub2e4. GROUP BY \uc808\uc740 \uc77c\ubc18\uc801\uc73c\ub85c \uc9c8\uc758\ubb38\uc73c\ub85c\ubd80\ud130 \uc5bb\uc740 \uacb0\uacfc\uc5d0 \ub300\ud574 GROUP BY \uc808\uc5d0 \uba85\uc2dc\ud55c \uce7c\ub7fc\uc758 \uac12\uc774 \uac19\uc744 \ub54c \uadf8\ub8f9\uc744 \ub9cc\ub4e4\uace0, \uc774 \uadf8\ub8f9\uc73c\ub85c\ubd80\ud130 SQL \ud45c\uc900 \ud568\uc218\uc778 \uc9d1\ud569 \ud568\uc218\ub97c \ud1b5\ud574 \ub2e4\uc591\ud55c \uacb0\uacfc\ub97c \uc5bb\ub294\ub2e4.<\/p>\n<p>SQL&gt; SELECT AVG(salary)<br \/>&nbsp; 2&nbsp; FROM employees;<\/p>\n<p>AVG(SALARY)<br \/>&#8212;&#8212;&#8212;&#8211;<br \/>&nbsp;6461.68224<\/p>\n<p>&nbsp;\ub300\ub7b5 $6,462 \uc815\ub3c4\ub97c \uc5bb\uc744 \uc218 \uc788\ub2e4. AVG() \ud568\uc218\ub294 \ud558\ub098 \uc774\uc0c1\uc758 \uac12\ub4e4\ub85c\ubd80\ud130 \ud3c9\uade0\uac12\uc744 \ubc18\ud658\ud55c\ub2e4. \uadf8\ub807\ub2e4\uba74 $10,000 \uc774\uc0c1\uc758 \uc5f0\ubd09\uc790\ub4e4\uc758 \ud3c9\uade0\uc740 \uc5bc\ub9c8\uc77c\uae4c<\/p>\n<p>SQL&gt; SELECT AVG(salary)<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE salary &gt;= 10000;<\/p>\n<p>AVG(SALARY)<br \/>&#8212;&#8212;&#8212;&#8211;<br \/>&nbsp;12631.5789<\/p>\n<p>&nbsp;\uc774 \uacbd\uc6b0\ub294 WHERE\uc808\uc744 \ub9cc\uc871\ud558\ub294 \ud589\uc758 \uacb0\uacfc\ub97c \ud558\ub098\uc758 \uadf8\ub8f9\uc73c\ub85c \ubcf4\uace0 \ud3c9\uade0\uc744 \uc5bb\uc740 \uacbd\uc6b0\uc774\ub2e4.<\/p>\n<p>&nbsp;\uadf8\ub807\ub2e4\uba74, \ubd80\uc11c\ubcc4 \uae09\uc5ec\uc758 \ud3c9\uade0\uc744 \uc5bb\uc5b4\ubcf4\uc790. \ubd80\uc11c\ubcc4 \ud3c9\uade0\uc740 \uac01\uac01\uc758 \ubd80\uc11c\ub9c8\ub2e4 \ud3c9\uade0\uc744 \uc5bb\uc5b4\uc57c \ud558\ubbc0\ub85c \uac19\uc740 \ubd80\uc11c \ub2e8\uc704\ub85c \uadf8\ub8f9\uc744 \ubb36\uc5b4 \ud3c9\uade0\uc744 \uc5bb\ub294\ub2e4.<\/p>\n<p>SQL&gt; SELECT department_id, AVG(salary)<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; GROUP BY department_id<br \/>&nbsp; 4&nbsp; ORDER BY department_id;<\/p>\n<p>DEPARTMENT_ID AVG(SALARY)<br \/>&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 10 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 4400<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 20 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 9500<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 30 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 4150<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 40 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 6500<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 50&nbsp; 3475.55556<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 60 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 5760<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 70 &nbsp;&nbsp; &nbsp; &nbsp; 10000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 80&nbsp; 8955.88235<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 90&nbsp; 19333.3333<br \/>&nbsp; &nbsp; &nbsp; 100 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 8600<br \/>&nbsp; &nbsp; &nbsp; 110 &nbsp;&nbsp; &nbsp; &nbsp; 10150<\/p>\n<p>DEPARTMENT_ID AVG(SALARY)<br \/>&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 7000<\/p>\n<p>12 rows selected.<\/p>\n<p>&nbsp;\uacb0\uacfc\ub97c \ubcf4\uba74 \ubd80\uc11c \uc544\uc774\ub514\uac00 \uc624\ub984\ucc28\uc21c \uc815\ub82c\ub418\uc5b4 \ubd80\uc11c\ub9c8\ub2e4 \ud574\ub2f9 \ubd80\uc11c\uc5d0 \uc18d\ud55c \uc0ac\uc6d0\uc758 \ud3c9\uade0 \uae09\uc5ec\ub97c \uc5bb\uc5b4\ub0b4\uace0 \uc788\ub2e4. \ucc38\uace0\ub85c NULL \uac12(\ud560\ub2f9\ub418\uc9c0 \uc54a\uc740 \uac12)\uc740 \uc624\ub984\ucc28\uc21c \uc815\ub82c\ud560 \ub54c \uc704\uc640 \uac19\uc774 \uac00\uc7a5 \ub098\uc911\uc5d0 \ub098\ud0c0\ub09c\ub2e4.<\/p>\n<p>&nbsp;\ub2e4\uc74c\uc758 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uc9c8\uc758\ubb38\uc744 \uc791\uc131\ud574 \ubcf4\ub77c.<br \/>&nbsp;\uc694\uad6c\uc0ac\ud56d &#8211; \uc9c1\ubb34\ubcc4\ub85c \ucd5c\ub300 \uae09\uc5ec\uc640 \ucd5c\uc18c \uae09\uc5ec\ub97c \uc0b4\ud3b4 \ubcf4\uace0\uc790 \ud55c\ub2e4. \ub2e8 \uc9c1\ubb34\ub294 \uc601\uc5c5 \ubd80\uc11c\ub85c \uc81c\ud55c\ud55c\ub2e4.<\/p>\n<p>&nbsp;\uba3c\uc800 \uc0ac\uc6d0 \ud14c\uc774\ube14\uc5d0\uc11c \uace0\ub824\ud574\uc57c \ud560 \uce7c\ub7fc\uc774 \ubb34\uc5c7\uc778\uc9c0 \uc0b4\ud3b4\ubcf4\uc544\uc57c \ud55c\ub2e4. \uadf8\ub9ac\uace0 \uc601\uc5c5 \ubd80\uc11c\ub294 \uc5b4\ub5bb\uac8c \ud45c\ud604\ub418\uace0 \uc788\ub294\uc9c0 \uc0b4\ud3b4\ubcf4\uc544\uc57c \ud55c\ub2e4. \uc601\uc5c5 \ubd80\uc11c\ub294 \ub2e4\uc2dc \uc601\uc5c5 \ub300\ud45c(SA_REP)\uc640&nbsp; \uc774\ub4e4\uc758 \uad00\ub9ac\uc790\uc778 \uc601\uc5c5 \uad00\ub9ac\uc790(SA_MIN)\uac00 \uc788\ub2e4.<\/p>\n<p>&nbsp;\uadf8\ub7fc \uc6b0\uc120 \ub300\uc0c1\uc774 \ub418\ub294 \uc9c8\uc758\ubb38\uc744 \uc791\uc131\ud55c\ub2e4.<\/p>\n<p>SQL&gt; SELECT job_id, salary<br \/>&nbsp; 2&nbsp; FROM employees;<\/p>\n<p>&nbsp;\uc774 \uacb0\ub85c\ubd80\ud130 \uba3c\uc800 \ubd80\uc11c\ub97c \uc81c\ud55c\ud55c\ub2e4.<\/p>\n<p>SQL&gt; SELECT job_id, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE job_id IN(&#8216;SA_REP&#8217;, &#8216;SA_MAN&#8217;);<\/p>\n<p>&nbsp;\ub9c8\uc9c0\ub9c9\uc73c\ub85c \uc704 \uacb0\ub85c\ubd80\ud130 \uae09\uc5ec\uc758 \ucd5c\ub300\uac12\/\ucd5c\uc18c\uac12\uc744 \uc5bb\ub294\ub2e4. \ud558\ub098 \uc774\uc0c1\uc758 \ud589\uc73c\ub85c\ubd80\ud130 \ucd5c\ub300\uac12\/\ucd5c\uc18c\uac12\uc744 \ubc18\ud658\ud558\ub294 MAX() \/ MIN() \ud568\uc218\ub97c \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n<p>SQL&gt; SELECT job_id, MAX(salary), MIN(salary)<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE job_id IN(&#8216;SA_REP&#8217;, &#8216;SA_MAN&#8217;)<br \/>&nbsp; 4&nbsp; GROUP BY job_id;<\/p>\n<p>JOB_ID &nbsp;&nbsp; &nbsp;&nbsp; MAX(SALARY) MIN(SALARY)<br \/>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;<br \/>SA_MAN &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;14000 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 10500<br \/>SA_REP &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;11500 &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; 6100<\/p>\n<p>&nbsp;2) GROUP BY \uc751\uc6a9<br \/>&nbsp;-&gt; \uc5f0\ub3c4\ubcc4 \uc785\uc790\ub4e4\uc758 \ud3c9\uade0\uc740 \uc5bc\ub9c8\uc778\uc9c0 \ub098\ud0c0\ub0b4 \ubcf4\ub77c.<\/p>\n<p>SQL&gt; SELECT hire_date, salary<br \/>&nbsp; 2&nbsp; FROM employees;<\/p>\n<p>&nbsp;\uc785\uc0ac\uc77c(hire_date)\uc744 \uc5f0\ub3c4\ub85c \ubcc0\ud658\ud55c \ud6c4 GROUP BY\ub97c \uc774\uc6a9\ud558\uc5ec \uadf8\ub8f9\ud654\ud55c\ub2e4. TO_CHAR() \ud568\uc218\ub97c \uc0ac\uc6a9\ud558\uba74 \ub0a0\uc9dc \ud615\uc2dd\uc758 \ub370\uc774\ud130, \uc608\ub97c \ub4e4\uc5b4 &#8217;99\/06\/21&#8217;\uc744 \uc5f0\ub3c4 4\uc790\ub9ac \ub370\uc774\ud130 &#8216;1999&#8217;\ub85c \ubcc0\ud658\ud560 \uc218 \uc788\ub2e4.<\/p>\n<p>SQL&gt; SELECT hire_date, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; GROUP BY TO_CHAR(hire_date, &#8216;YYYY&#8217;);<br \/>SELECT hire_date, salary<br \/>&nbsp; &nbsp; &nbsp;&nbsp; *<br \/>ERROR at line 1:<br \/>ORA-00979: not a GROUP BY expression<\/p>\n<p>&nbsp;\uc704\uc758 \uc624\ub958\ub97c \ubcf4\uba74 SELECT \uc808\uc758 hire_date\uc758 \uce7c\ub7fc\uc774 GROUP BY\uc758 \ud45c\ud604\uc774 \uc544\ub2c8\ub77c\ub294 \uc624\ub958\ub97c \ub098\ud0c0\ub0b4\uace0 \uc788\ub2e4. \uc774\uc640 \uac19\uc740 \uc624\ub958\ub294 GROUP BY \uc808\uc744 \uc0ac\uc6a9\ud560 \ub54c SELECT\uc808\uc5d0 \uc0ac\uc6a9\ub420 \uc218 \uc788\ub294 \uce7c\ub7fc\uc774 \uc81c\ud55c\uc801\uc784\uc744 \ub9d0\ud574\uc900\ub2e4. \uc989, GROUP BY\uc808\uc5d0\uc11c \uc0ac\uc6a9\ud55c \uce7c\ub7fc\uacfc \uadf8\ub8f9 \ud568\uc218(\uc608\ub97c \ub4e4\uba74, \ud3c9\uade0\uc744 \uad6c\ud558\ub294 AVG() \ud568\uc218\ub098 \ucd5c\ub300 \uac12\uc744 MAX() \ud568\uc218 \ub4f1)\ub9cc\uc774 \uc0ac\uc6a9\ub420 \uc218 \uc788\ub2e4.<br \/>&nbsp;\ub530\ub77c\uc11c, GROUP BY \uc2dd\uc5d0\uc11c \uc0ac\uc6a9\ud55c \uce7c\ub7fc\uc774 TO_CHAR() \ud568\uc218\uc5d0 \uc758\ud574 \uac12\uc774 \ubcc0\ud615\ub418\uc5c8\ub2e4\uba74 \ubcc0\ud615\ub41c \ud615\ud0dc \uadf8\ub300\ub85c SELECT\uc808\uc5d0\uc11c \uc0ac\uc6a9\ub418\uc5b4\uc57c \ud55c\ub2e4.<\/p>\n<p>&nbsp;SQL&gt; SELECT TO_CHAR(hire_date, &#8216;YYYY&#8217;), AVG(salary)<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; GROUP BY TO_CHAR(hire_date, &#8216;YYYY&#8217;);<\/p>\n<p>TO_C AVG(SALARY)<br \/>&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>2000&nbsp; 5381.81818<br \/>1987 &nbsp;&nbsp; &nbsp;&nbsp; 14200<br \/>1997&nbsp; 6460.71429<br \/>1994&nbsp; 9828.57143<br \/>1991 &nbsp;&nbsp; &nbsp; &nbsp; 6000<br \/>1995 &nbsp;&nbsp; &nbsp; &nbsp; 4525<br \/>1990 &nbsp;&nbsp; &nbsp; &nbsp; 9000<br \/>1989 &nbsp;&nbsp; &nbsp;&nbsp; 17000<br \/>1999&nbsp; 4938.88889<br \/>1996 &nbsp;&nbsp; &nbsp; &nbsp; 8600<br \/>1993 &nbsp;&nbsp; &nbsp;&nbsp; 17000<\/p>\n<p>TO_C AVG(SALARY)<br \/>&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>1998&nbsp; 4873.91304<\/p>\n<p>12 rows selected.<\/p>\n<p>&nbsp;2.5 HAVING<\/p>\n<p>&nbsp;1) HAVING\uc808\uc758 \uc774\uc6a9<br \/>&nbsp;-&gt; \ub9cc\uc57d \ucc98\uc74c GROUP BY \uc218\ud589 \uacb0\uacfc\ub85c\ubd80\ud130 \ubd80\uc11c\ubcc4 \ud3c9\uade0 \uae09\uc5ec\uac00 $10,000 \uc774\uc0c1\uc778 \ubd80\uc11c\ub9cc\uc744 \uc5bb\uace0\uc790 \ud55c\ub2e4\uba74 \uc5b4\ub5bb\uac8c \ud574\uc57c \ud560\uae4c? GROUP BY \uc808\uc758 \uacb0\uacfc\ub85c\ubd80\ud130 \ud2b9\uc815 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uac12\uc744 \uc5bb\uace0\uc790 \ud55c\ub2e4\uba74 HAVING\uc808\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub2e4.<\/p>\n<p>SQL&gt; SELECT department_id, AVG(salary)<br \/>&nbsp; 2&nbsp; FROM employees <br \/>&nbsp; 3&nbsp; GROUP BY department_id<br \/>&nbsp; 4&nbsp; HAVING AVG(salary) &gt;= 10000;<\/p>\n<p>DEPARTMENT_ID AVG(SALARY)<br \/>&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 70 &nbsp;&nbsp; &nbsp; &nbsp; 10000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 90&nbsp; 19333.3333<br \/>&nbsp; &nbsp; &nbsp; 110 &nbsp;&nbsp; &nbsp; &nbsp; 10150<\/p>\n<p>&nbsp;HAVING\uc808\uc740 GROUP BY \uc808\uc758 \uc218\ud589 \uacb0\uacfc\ub97c \ub300\uc0c1\uc73c\ub85c \ub2e4\uc2dc \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uacb0\uacfc\ub97c \uc5bb\uc5b4\uc628\ub2e4.<\/p>\n<p>&nbsp;2) \ube44\ud6a8\uc728\uc801\uc778 HAVING\uc808<br \/>&nbsp;-&gt; \uc544\ub798 SQL\ubb38\uc740 HAVING\uc808\uc774 \ube44\ud6a8\uc728\uc801\uc73c\ub85c \uc0ac\uc6a9\ub41c \uacbd\uc6b0\uc774\ub2e4. \uc694\uad6c \uc870\uac74\uc740 \ubd80\uc11c\ubcc4 \ucd5c\ub300 \uae09\uc5ec\ub97c \uc5bb\ub294 \uac83\uc774\ub2e4.<\/p>\n<p>SQL&gt; SELECT department_id, MAX(salary)<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; GROUP BY department_id<br \/>&nbsp; 4&nbsp; HAVING department_id IN (10, 20);<\/p>\n<p>DEPARTMENT_ID MAX(SALARY)<br \/>&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 20 &nbsp;&nbsp; &nbsp; &nbsp; 13000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 10 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 4400<\/p>\n<p>&nbsp;\uc5b4\ub5a4 \uad6c\ubb38\uc774 \uac1c\uc120\ub418\uc5b4\uc57c \ud558\ub098? SQL\ubb38\uc740 \uc6d0\ud558\ub294 \uacb0\uacfc\ub97c \uc5bb\uae30 \uc704\ud574 \ub2e4\uc591\ud558\uac8c \uc791\uc131\ub420 \uc218 \uc788\ub2e4. \ub530\ub77c\uc11c \ud558\ub098\uc758 SQL\ubb38\uc774 \ub2f5\uc774 \ub420 \uc218 \uc5c6\ub2e4. SQL\ubb38\uc5d0\uc11c\ub294 \ubb34\uc5c7\uc774 \ucd5c\uc120\uc758 \uc9c8\uc758\ubb38\uc774 \ub420 \uc218 \uc788\ub290\ub0d0\uac00 \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub97c \uc774\uc6a9\ud558\uc5ec \uac1c\ubc1c\ud558\ub294 \uc5ec\ub7ec\ubd84\uc5d0\uac8c \uac00\uc7a5 \uc911\uc694\ud55c \ud575\uc2ec\uc774\ub77c \ud560 \uc218 \uc788\ub2e4.<\/p>\n<p>&nbsp;\uc704\uc758 \uc2e4\uc218\ub294 \uc5b4\ub514\uc5d0\uc11c \ube44\ub86f\ub418\uc5c8\ub294\uc9c0 \uc704 \uc9c8\uc758\ubb38\uc758 \uc218\ud589 \uacfc\uc815\uc744 \ub2e4\uc2dc \ud55c \ubc88 \uc0dd\uac01\ud574 \ubcf4\ub77c. \ub450 \uac00\uc9c0 \uc811\uadfc \ubc29\ubc95\uc744 \uc0dd\uac01\ud574 \ubcfc \uc218 \uc788\ub2e4.<\/p>\n<p>&nbsp;\uba3c\uc800 \ucd9c\ubc1c\uc740 \uac19\uc740 \uc9c8\uc758\ubb38\uc73c\ub85c\ubd80\ud130 \uc2dc\uc791\ud55c\ub2e4.<\/p>\n<p>SQL&gt; SELECT department_id, salary<br \/>&nbsp; 2&nbsp; FROM employees;<\/p>\n<p>&nbsp;\uadf8\ub9ac\uace0 \uc55e\uc11c \uc218\ud589\ud55c \ubc29\ubc95\uc740 \uc774 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 107\ud589\uc744 \ub300\uc0c1\uc73c\ub85c GROUP BY \uc808\uc744 \uc218\ud589\ud558\uc5ec \uc544\ub798\uc640 \uac19\uc740 \uacb0\uacfc\ub97c \uc5bb\uc5c8\ub2e4.<br \/>&nbsp;<br \/>SQL&gt; SELECT department_id, MAX(salary)<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; GROUP BY department_id;<\/p>\n<p>DEPARTMENT_ID MAX(SALARY)<br \/>&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211;<br \/>&nbsp; &nbsp; &nbsp; 100 &nbsp;&nbsp; &nbsp; &nbsp; 12000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 30 &nbsp;&nbsp; &nbsp; &nbsp; 11000<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 7000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 20 &nbsp;&nbsp; &nbsp; &nbsp; 13000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 70 &nbsp;&nbsp; &nbsp; &nbsp; 10000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 90 &nbsp;&nbsp; &nbsp; &nbsp; 24000<br \/>&nbsp; &nbsp; &nbsp; 110 &nbsp;&nbsp; &nbsp; &nbsp; 12000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 50 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 8200<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 40 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 6500<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 80 &nbsp;&nbsp; &nbsp; &nbsp; 14000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 10 &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 4400<\/p>\n<p>&nbsp;\uc774 \uacb0\uacfc\ub85c\ubd80\ud130 HAVING\uc808\uc5d0\uc11c \uc6d0\ud558\ub294 \ubd80\uc11c \uc544\uc774\ub514\uc5d0 \ud574\ub2f9\ud558\ub294 \uacb0\uacfc\ub97c \uc5bb\uace0 \uc788\ub2e4.<\/p>\n<p>&nbsp;\ub610 \ub2e4\ub978 \ubc29\ubc95\uc740 \uba3c\uc800 \ub300\uc0c1\uc774 \ub418\ub294 \ubd80\uc11c \uc544\uc774\ub514\ub97c WHERE\uc808\uc5d0\uc11c \uc81c\ud55c\ud558\ub294 \uac83\uc774\ub2e4.<\/p>\n<p>SQL&gt; SELECT department_id, salary<br \/>&nbsp; 2&nbsp; FROM employees<br \/>&nbsp; 3&nbsp; WHERE department_id IN (10, 20);<\/p>\n<p>DEPARTMENT_ID &nbsp;&nbsp; &nbsp; SALARY<br \/>&#8212;&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 10 &nbsp;&nbsp; &nbsp; &nbsp; 4400<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 20 &nbsp;&nbsp; &nbsp;&nbsp; 13000<br \/>&nbsp; &nbsp; &nbsp;&nbsp; 20 &nbsp;&nbsp; &nbsp; &nbsp; 6000<\/p>\n<p>&nbsp;\uc55e\uc758 \ubc29\ubc95\uc740 107\ud589\uc5d0 \ub300\ud574 \ub3d9\uc77c \ubd80\uc11c \uc544\uc774\ub514\uc5d0 \ub300\ud574 \uae09\uc5ec \uce7c\ub7fc\uc758 \uac12\uc744 \ud558\ub098\uc529 \ube44\uad50\ud574 \uac00\uba74\uc11c \ucd5c\ub300 \uac12\uc744 \ucc3e\ub294 \uacfc\uc815\uc778\ub370 \ubc18\ud574 \uc5ec\uae30\uc11c\ub294 3\ud589\uc5d0 \ub300\ud574\uc11c\ub9cc \uc218\ud589\ud558\uace0 \uc788\ub2e4. \uc5b4\ub290 \uac83\uc774 \ub354 \ud6a8\uc728\uc801\uc778 \uc811\uadfc \ubc29\ubc95\uc774\uaca0\ub294\uac00?<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\uc694\uc57d.&nbsp;1. \ud14c\uc774\ube14\uc5d0 \uc800\uc7a5\ub41c \ubaa8\ub4e0 \ub370\uc774\ud130\ub97c \ubcf4\uace0\uc790 \ud569\ub2c8\ub2e4. SELECT\uc640 FROM\uc808\ub85c \ub9cc\ub4e4\uc5b4 \ubcf4\ub77c.-&gt; SELECT \uce7c\ub7fc1, \uce7c\ub7fc2 FROM \ud14c\uc774\ube14 &nbsp;2. \uc804\uccb4 \ub370\uc774\ud130 \uc911 \uc870\uac74\uc744 \ub9cc\uc871\ud558\ub294 \uac12\ub9cc \ubcf4\uace0 \uc2f6\uc2b5\ub2c8\ub2e4. WHERE \uc808\uc744 \uc774\uc6a9\ud574 \ubcf4\ub77c.-&gt; WHERE \uce7c\ub7fc \uc870\uac74 \uac12 &nbsp;3. \uc77c\uc815\ud55c \uae30\ubd84\uc5d0 \uc758\ud574 \uc815\ub82c\ub418\uc5b4 \ud45c\ud604\ud558\uba74 \ubcf4\ub2e4 &hellip; <a href=\"http:\/\/pchero21.com\/?p=709\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[298,299,358],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/709"}],"collection":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=709"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}