{"id":7394,"date":"2024-09-15T17:21:22","date_gmt":"2024-09-15T17:21:22","guid":{"rendered":"https:\/\/pohang.eduwp.kr\/?p=7394"},"modified":"2026-04-20T04:31:03","modified_gmt":"2026-04-20T04:31:03","slug":"5%ec%a3%bc%ec%b0%a8-3","status":"publish","type":"post","link":"https:\/\/pohang.eduwp.kr\/?p=7394","title":{"rendered":"5\uc8fc\ucc28"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"\ubaa9\ucc28 \ud1a0\uae00\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#group_by%EC%A0%88_having_%EC%A0%88\" >group by\uc808, having \uc808<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#rollup_%EC%A4%91%EA%B0%84_%ED%95%A9%EA%B3%84_%ED%91%9C%ED%98%84\" >rollup \uc911\uac04 \ud569\uacc4 \ud45c\ud604<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%84%A0%ED%83%9D%ED%95%98%EB%A9%B4%EC%84%9C_%EB%B3%B5%EC%82%AC%ED%95%98%EA%B8%B0_%EB%AA%85%EB%A0%B9%EC%96%B4\" >\ud14c\uc774\ube14 \uc120\ud0dd\ud558\uba74\uc11c \ubcf5\uc0ac\ud558\uae30 \uba85\ub839\uc5b4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%82%AD%EC%A0%9C\" >\ud14c\uc774\ube14 \uc0ad\uc81c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%88%98%EC%A0%95\" >\ud14c\uc774\ube14 \uc218\uc815<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#alert_%EB%AA%85%EB%A0%B9%EC%96%B4_alter_%ED%85%8C%EC%9D%B4%EB%B8%94%EB%AA%85_add_column_%EC%BB%AC%EB%9F%BC%EB%AA%85_%ED%83%80%EC%9E%85\" >alert \uba85\ub839\uc5b4 :\u00a0 alter \ud14c\uc774\ube14\uba85 add column \uceec\ub7fc\uba85 \ud0c0\uc785;<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%9E%91%EC%84%B1_%EC%8B%A4%EC%8A%B5_%EB%8B%A4%EC%8B%9C%ED%95%98%EA%B8%B0\" >\ud14c\uc774\ube14 \uc791\uc131 \uc2e4\uc2b5 \ub2e4\uc2dc\ud558\uae30<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#mysql_%EC%9C%A0%EC%A0%80_%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0_DCL_%EB%AA%85%EB%A0%B9%EC%96%B4\" >mysql \uc720\uc800 \ucd94\uac00\ud558\uae30 (DCL \uba85\ub839\uc5b4)<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%EC%83%9D%EC%84%B1%EB%AA%85%EB%A0%B9_%ED%8C%A8%EC%8A%A4%EC%9B%8C%EB%93%9C_%EB%B3%80%EA%B2%BD_%EC%82%AC%EC%9A%A9%EC%9E%90%EC%82%AD%EC%A0%9C\" >\uc0dd\uc131\uba85\ub839, \ud328\uc2a4\uc6cc\ub4dc \ubcc0\uacbd, \uc0ac\uc6a9\uc790\uc0ad\uc81c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%EA%B6%8C%ED%95%9C_%EB%B3%B4%EA%B8%B0\" >\uad8c\ud55c \ubcf4\uae30<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/pohang.eduwp.kr\/?p=7394\/#%EC%9B%8C%ED%81%AC%EB%B2%A4%EC%B9%98%EC%97%90%EC%84%9C_%EC%82%AC%EC%9A%A9%EC%9E%90_%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0\" >\uc6cc\ud06c\ubca4\uce58\uc5d0\uc11c \uc0ac\uc6a9\uc790 \ucd94\uac00\ud558\uae30<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"group_by%EC%A0%88_having_%EC%A0%88\"><\/span>group by\uc808, having \uc808<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">2\uac1c\uc758 \uad6c\ubb38 \ucc28\uc774\uc810 \uc0b4\ud3b4\ubcf4\uae30\r\n\r\n\r\nselect userID AS '\uc0ac\uc6a9\uc790 ' , sum(price*amount) as '\ucd1d\uad6c\ub9e4\uc561' from buytbl where sum(price* amount) &gt; 10000 group by userID;\r\n\r\nselect userID AS '\uc0ac\uc6a9\uc790 ' , sum(price*amount) as '\ucd1d\uad6c\ub9e4\uc561' from buytbl group by userID having sum(price * amount) &gt; 1000;\r\n\r\n\r\n-- \ucd1d\uad6c\ub9e4\uc561\uc774 100\uc6d0 \uc774\uc0c1\uc778 \uc0ac\ub78c\uc744 \ud569\uacc4\uc21c\uc11c\ub370\ub85c \ucd9c\ub825\ud558\ub294 \ucffc\ub9ac \uad6c\ubb38(\ub0b4\ub9bc\ucc28\uc21c,\uc624\ub984\ucc28\uc21c \uc635\uc158)\r\n\r\nselect userID as '\uc0ac\uc6a9\uc790' , sum(price * amount) as '\ucd1d\uad6c\ub9e4\uc561 ' from buytbl where sum(price*amount) &gt; 100 group by userID;  -- \uc624\ub958\uc758 \uc6d0\uc778 \uc0b4\ud3b4\ubcf4\uae30 --\r\n\r\nselect userID as '\uc0ac\uc6a9\uc790' , sum(price * amount) as '\ucd1d\uad6c\ub9e4\uc561 ' from buytbl;\r\nselect userID as '\uc0ac\uc6a9\uc790' , sum(price * amount) as '\ucd1d\uad6c\ub9e4\uc561 ' from buytbl group by userID;\r\nselect userID as '\uc0ac\uc6a9\uc790' , sum(price * amount) as '\ucd1d\uad6c\ub9e4\uc561 ' from buytbl group by userID having sum(price * amount) &gt; 100;\r\nselect userID as '\uc0ac\uc6a9\uc790' , sum(price * amount) as '\ucd1d\uad6c\ub9e4\uc561 ' from buytbl group by userID having sum(price * amount) &gt; 100 order by sum(price*amount);\r\n<\/pre>\n<p>having\uc740 where\uc640 \ube44\uc2b7\ud55c \uac1c\ub150\uc73c\ub85c \uc870\uac74\uc2dd\uc744 \uac78\uc9c0\ub9cc \uc9d1\uacc4 \ud568\uc218\uc5d0 \ub300\ud574\uc11c \uc870\uac74\uc744 \uc81c\ud55c\ud558\ub294 \uac83, having\uc808\uc740 \uaf2d gruop by \ub4a4\uc5d0 \ub098\uc640\uc57c \ud55c\ub2e4. \uc21c\uc11c \ubc14\ub00c\uba74 \uc624\ub958\ubc1c\uc0dd<\/p>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"rollup_%EC%A4%91%EA%B0%84_%ED%95%A9%EA%B3%84_%ED%91%9C%ED%98%84\"><\/span>rollup \uc911\uac04 \ud569\uacc4 \ud45c\ud604<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">select num, groupName, sum(price * amount) AS '\ube44\uc6a9' from buytbl group by groupName, num with rollup;\r\nselect num, groupName, sum(price * amount) AS '\ube44\uc6a9' from buytbl group by groupName with rollup;<\/pre>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%84%A0%ED%83%9D%ED%95%98%EB%A9%B4%EC%84%9C_%EB%B3%B5%EC%82%AC%ED%95%98%EA%B8%B0_%EB%AA%85%EB%A0%B9%EC%96%B4\"><\/span>\ud14c\uc774\ube14 \uc120\ud0dd\ud558\uba74\uc11c \ubcf5\uc0ac\ud558\uae30 \uba85\ub839\uc5b4<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">create table buytbl2 (select * from buytbl);\r\n\r\nselect * from buytbl2;\r\n\r\ncreate table buytbl3 (select userID, prodName from buytbl);<\/pre>\n<h1><\/h1>\n<h1><span class=\"ez-toc-section\" id=\"%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%82%AD%EC%A0%9C\"><\/span>\ud14c\uc774\ube14 \uc0ad\uc81c<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>drop table ****;<\/p>\n<hr \/>\n<h1><\/h1>\n<h1><span class=\"ez-toc-section\" id=\"%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%88%98%EC%A0%95\"><\/span>\ud14c\uc774\ube14 \uc218\uc815<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2><span class=\"ez-toc-section\" id=\"alert_%EB%AA%85%EB%A0%B9%EC%96%B4_alter_%ED%85%8C%EC%9D%B4%EB%B8%94%EB%AA%85_add_column_%EC%BB%AC%EB%9F%BC%EB%AA%85_%ED%83%80%EC%9E%85\"><\/span>alert \uba85\ub839\uc5b4 :\u00a0 alter \ud14c\uc774\ube14\uba85 add column \uceec\ub7fc\uba85 \ud0c0\uc785;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>\uae30\uc874 \ud14c\uc774\ube14\uc5d0 \uc2e0\uaddc \ud544\ub4dc(\uceec\ub7fc) \ucd94\uac00\ud558\ub294 \uacbd\uc6b0 : alter table usertbl add column model_type varchar(10) not null;<\/li>\n<li>\uae30\uc874 \ud14c\uc774\ube14 \uceec\ub7fc\uc758 \ud0c0\uc785\uc744 \ubcc0\uacbd : alter table usertbl modify column model_type varchar(30);<\/li>\n<li>\uae30\uc874 \ud14c\uc774\ube14 \uceec\ub7fc\uc758\u00a0 \uc774\ub984\uc744 \ubcc0\uacbd : alter table usertbl add column model_type varchar(10) not null;<\/li>\n<li>\uae30\uc874 \ud14c\uc774\ube14 \uceec\ub7fc\uc744 \uc0ad\uc81c : alter table usertbl add column model_type varchar(10) not null;<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">-- model_type\ub77c\ub294 \uceec\ub7fc\uc744 \ucd94\uac00 --\r\n\r\nalter table usertbl add column model_type varchar(10) not null;\r\n\r\n\r\n\r\n\r\n-- model_type \ud0c0\uc785 \ubcc0\uacbd --\r\n\r\nalter table usertbl modify column model_type varchar(30);\r\n\r\n\r\n\r\n\r\n-- \uceec\ub7fc \uc774\ub984 \ubcc0\uacbd --\r\n\r\nalter table usertbl change column \uc6d0\ub798\uc774\ub984 \ubcc0\uacbd\ud560\uc774\ub984;\r\n\r\n\r\n\r\n\r\n-- \uceec\ub7fc \uc0ad\uc81c --\r\n\r\nalter table usertbl drop column \uceec\ub7fc\uc774\ub984;\r\n\r\n\r\n\r\n\r\n-- \ud0c0\uc785\uc744 \ubcc0\uacbd\ud558\uac70\ub098 \uc0ad\uc81c\ud560\ub54c\ub294 \uacbd\uace0 \ubb38\uad6c\uac00 \ub72c\ub2e4. \uae30\uc874\uc5d0 \ub370\uc774\ud130\uac00 \uc788\uc744 \uacbd\uc6b0 \ub370\uc774\ud130\uc758 \uc190\uc2e4\uc774 \uc62c \uc218 \uc788\ub2e4\uace0 \uacbd\uace0\ud568<\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li>\ud14c\uc774\ube14\uc744 \uc0dd\uc131\ud560\ub54c int \ud615\uc5d0\uc11c unsigned \uc0ac\uc6a9\ud558\uac8c \ub418\uba74 \uc74c\uc218\ub97c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uace0 \ubaa8\ub450 \uc591\uc218\ub85c \uc804\ud658\ub41c\ub2e4. \uadf8\ub9ac\uace0 mysql 8.0 \uc774\ud6c4\ubd80\ud130\ub294 int(\uc22b\uc790) \ubd80\ubd84\uc5d0\uc11c \uc22b\uc790\ub97c \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294\ub2e4.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr \/>\n<h1><span class=\"ez-toc-section\" id=\"%ED%85%8C%EC%9D%B4%EB%B8%94_%EC%9E%91%EC%84%B1_%EC%8B%A4%EC%8A%B5_%EB%8B%A4%EC%8B%9C%ED%95%98%EA%B8%B0\"><\/span>\ud14c\uc774\ube14 \uc791\uc131 \uc2e4\uc2b5 \ub2e4\uc2dc\ud558\uae30<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\ud14c\uc774\ube14\uc774 \uae30\uc874\uc5d0 \uc788\uc73c\uba70 \uc0ad\uc81c\ud558\uace0 mytable\ub780 \uc774\ub984\uc73c\ub85c \uc544\uc774\ub514,\uc774\ub984,\ubaa8\ub378\ub118\ubc84,\uc2dc\ub9ac\uc988, \ud504\ub77c\uc774\uba38\ub9ac\ud0a4 \uac12\uc744 \uc0dd\uc131\ud55c\ub2e4.<\/p>\n<p>id : \uc790\ub3d9\uc22b\uc790 \ucd94\uac00, \uc591\uc218, \ud504\ub77c\uc774\uba38\ub9ac\ud0a4<\/p>\n<p>name : \uc774\ub984 50\uc790<\/p>\n<p>\ubaa8\ub378\ub118\ubc84 : \uc774\ub984 15\uc790<\/p>\n<p>\uc2dc\ub9ac\uc988 : \uc774\ub984 30\uc790<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/p>\n<p>id\u00a0 \u00a0|\u00a0 name |\u00a0 medel_number\u00a0 | series<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>\ubcc0\uacbd\ud558\uae30 \uc2e4\uc2b5<\/p>\n<p>name : \uae00\uc790\uae38\uc774 20\ubcc0\uacbd<\/p>\n<p>model_number\u00a0 : model_num \uceec\ub7fc \uc774\ub984 \ubcc0\uacbd, \uae00\uc790\uae38\uc774\u00a0 10 \ubcc0\uacbd<\/p>\n<p>series :\u00a0 model_type \uceec\ub7fc \uc774\ub984 \ubcc0\uacbd, \uae00\uc790\uae38\uc774 10 \ubcc0\uacbd<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">drop table mytable;\r\ncreate table mytable (\r\nid int unsigned not null auto_increment,\r\nname varchar(50) not null,\r\nmodel_number varchar(15) not null,\r\nseries varchar(30) not null,\r\nprimary key ( id)\r\n);\r\n\r\ndesc mytable;<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">alter table mytable modify column name varchar(20) not\u00a0null;\r\nalter table mytable change column modelnumber model_num varchar(10) not null;\r\nalter table mytable change column series model_type varchar(10) not\u00a0null;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"mysql_%EC%9C%A0%EC%A0%80_%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0_DCL_%EB%AA%85%EB%A0%B9%EC%96%B4\"><\/span>mysql \uc720\uc800 \ucd94\uac00\ud558\uae30 (DCL \uba85\ub839\uc5b4)<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>mysql \ucee4\uba58\ub4dc \ubaa8\ub4dc\uc5d0\uc11c user \ub370\uc774\ud0c0\ubca0\uc774\uc2a4\ub97c \uc811\uadfc<\/p>\n<p>testuser \uc544\uc774\ub514\uc5d0 \ud328\uc2a4\uc6cc\ub4dc 1234\ub85c \uc720\uc800 \uc544\uc774\ub514 \ucd94\uac00, 2\uac00\uc9c0 \ubc29\ubc95 \ucc28\uc774 \uc54c\uae30<\/p>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%EC%83%9D%EC%84%B1%EB%AA%85%EB%A0%B9_%ED%8C%A8%EC%8A%A4%EC%9B%8C%EB%93%9C_%EB%B3%80%EA%B2%BD_%EC%82%AC%EC%9A%A9%EC%9E%90%EC%82%AD%EC%A0%9C\"><\/span>\uc0dd\uc131\uba85\ub839, \ud328\uc2a4\uc6cc\ub4dc \ubcc0\uacbd, \uc0ac\uc6a9\uc790\uc0ad\uc81c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">-- \uc720\uc800\ucd94\uac00\r\n\r\nmysql &gt; create user 'testuser'@localhost identified by '1234';\r\n\r\n\r\n- \ud328\uc2a4\uc6cc\ub4dc \ubcc0\uacbd\r\n\r\nmysql &gt; set password for 'testuser'@localhost = '12345678';\r\n\r\n\r\n- \ud328\uc2a4\uc6cc\ub4dc\uac00 \ubcc0\uacbd\ub41c \uac83\uc740 mysql \uc5d0\uc11c \ube60\uc838\ub098\uc640\uc11c \ub2e4\uc2dc \ub85c\uadf8\uc778\uc744 \ud574\uc11c \ud655\uc778\ud55c\ub2e4.\r\n\r\n\r\n\uc0ac\uc6a9\uc790\uc0ad\uc81c\r\n\r\nmysql &gt; drop user 'testuser'@localhost;\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%EA%B6%8C%ED%95%9C_%EB%B3%B4%EA%B8%B0\"><\/span>\uad8c\ud55c \ubcf4\uae30<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>grant \uba85\ub839\uc5b4\ub85c \uc544\uc774\ub514\ubcc4\ub85c \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc640 \ud14c\uc774\ube14\uc758 \uad8c\ud55c\uc744 \ubd80\uc5ec\ud560 \uc218 \uc788\ub2e4.<\/p>\n<p>\uc804\uccb4 \ubd80\uc5ec\ub294 *.*; \uc73c\ub85c \ucc98\ub9ac<\/p>\n<p>grant all on dbname.tableName;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">mysql &gt; grant all on *.*;\r\n\r\nmysql &gt; show grants for 'testuser'@localhost;\r\n\r\nmysql &gt; grant all on shopdb.usertbl to 'testuser'@localhost;\r\n\r\nmysql &gt; grant select, update on shopdb.usertbl to 'testuser'@localhost;\r\n\r\n-- shopdb\uc758 usertbl \ud14c\uc774\ube14\ub9cc select, update \uad8c\ud55c\uc744 \ubd80\uc5ec\ud55c\ub2e4.<\/pre>\n<p>&nbsp;<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%EC%9B%8C%ED%81%AC%EB%B2%A4%EC%B9%98%EC%97%90%EC%84%9C_%EC%82%AC%EC%9A%A9%EC%9E%90_%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0\"><\/span>\uc6cc\ud06c\ubca4\uce58\uc5d0\uc11c \uc0ac\uc6a9\uc790 \ucd94\uac00\ud558\uae30<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-7466\" src=\"https:\/\/pohang.eduwp.kr\/wp-content\/uploads\/2024\/09\/20240926_102851.jpg\" alt=\"\" width=\"589\" height=\"479\" srcset=\"https:\/\/pohang.eduwp.kr\/wp-content\/uploads\/2024\/09\/20240926_102851.jpg 589w, https:\/\/pohang.eduwp.kr\/wp-content\/uploads\/2024\/09\/20240926_102851-300x244.jpg 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/>administration\u00a0 \ud0ed\uc5d0\uc11c users and Privileges \ub97c \ud074\ub9ad\ud574\uc11c add acount \ub85c \uc811\uadfc\ud55c\ub2e4.<\/p>\n<p>\ubaa8\ub4e0 \uad8c\ud55c \uc8fc\uae30<\/p>\n<p>\ubd80\ubd84 \uad8c\ud55c \uc8fc\uae30<\/p>\n<p>\uc811\uadfc \uad8c\ud55c \uccb4\ud06c\ud558\uae30<\/p>\n<p>\ud300\uc7a5\ub2d8,\uc0ac\uc7a5\ub2d8 \uc544\uc774\ub514 \uc0dd\uc131\ud574\uc11c \uc811\uadfc \uad8c\ud55c \uc5f0\uc2b5\ud558\uae30<\/p>\n<hr \/>\n<p>root \uad8c\ud55c\uc774 \uc544\ub2c8\ub77c \uc0ac\uc7a5\ub2d8,\ud300\uc7a5\ub2d8 \uad8c\ud55c\uc73c\ub85c \ub85c\uadf8\uc778<\/p>\n<p>mysql connection \uc5d0\uc11c \ub9c8\uc6b0\uc2a4 \uc6b0\uce21 &gt; edit connetion \uc5d0\uc11c \uc720\uc800 \ub124\uc784\uc744 \ubcc0\uacbd\ud574\uc11c \ub85c\uadf8\uc778\ud55c\ub2e4.<\/p>\n<p>\ud300\uc7a5 : \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc0dd\uc131\ud574\ubcf4\uae30 create, drop \ub85c \uc0dd\uc131\uacfc \uc0ad\uc81c \ud14c\uc2a4\ud2b8<\/p>\n<p>\uc0ac\uc7a5 : \uc120\ud0dd\ub9cc \ud558\uae30\u00a0 select, delete from memberTBL; \ud14c\uc2a4\ud2b8 \ud574\ubcf4\uae30<\/p>\n<p>\uc77c\ubc18\uc9c1\uc6d0 : \ubd80\ubd84 \uad8c\ud55c \ud14c\uc2a4\ud2b8\ud574\ubcf4\uae30<\/p>\n","protected":false},"excerpt":{"rendered":"<p>group by\uc808, having \uc808 &nbsp; 2\uac1c\uc758 \uad6c\ubb38 \ucc28\uc774\uc810 \uc0b4\ud3b4\ubcf4\uae30 select userID AS &#8216;\uc0ac\uc6a9\uc790 &#8216; , sum(price*amount) as &#8216;\ucd1d\uad6c\ub9e4\uc561&#8217; from buytbl where sum(price* amount) &gt; 10000 group by userID; select userID&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-7394","post","type-post","status-publish","format-standard","category-mysql"],"_links":{"self":[{"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=\/wp\/v2\/posts\/7394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7394"}],"version-history":[{"count":6,"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=\/wp\/v2\/posts\/7394\/revisions"}],"predecessor-version":[{"id":7469,"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=\/wp\/v2\/posts\/7394\/revisions\/7469"}],"wp:attachment":[{"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pohang.eduwp.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}