{"id":34,"date":"2011-11-06T01:42:02","date_gmt":"2011-11-05T16:42:02","guid":{"rendered":"http:\/\/www.nukoneko.info\/?p=34"},"modified":"2012-11-17T22:06:35","modified_gmt":"2012-11-17T13:06:35","slug":"%e5%8b%89%e5%bc%b7%e3%83%a1%e3%83%a2-sql","status":"publish","type":"post","link":"https:\/\/www.nukoneko.info\/blog\/?p=34","title":{"rendered":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30e1\u30e2 MySQL"},"content":{"rendered":"<p id=\"sql_top\">\n<p>\u4f7f\u3044\u305d\u3046\u306aSQL\u6587\u3092\u30e1\u30e2\u308b\u3002<\/p>\n<p><!--more--><br \/>\n\u4ee5\u4e0b\u30ea\u30b9\u30c8<\/p>\n<table  class=\" table table-hover\" border=\"0\">\n<tr>\n<td style=\"font-size:15px;text-align: center;\">\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/td>\n<td style=\"font-size:15px;text-align: center;\"><a href=\"#sql_create\">CREATE<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size:15px;text-align: center;\">\u30ec\u30b3\u30fc\u30c9\u3092\u62bd\u51fa\u3059\u308b<\/td>\n<td style=\"font-size:15px;text-align: center;\"><a href=\"#sql_select\">SELECT<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"font-size:15px;text-align: center;\">\u30ec\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3059\u308b<\/td>\n<td style=\"font-size:15px;text-align: center;\"><a href=\"#sql_insertinto\">INSERT INTO<\/a><\/td>\n<\/tr>\n<\/table>\n<hr>\n<p id=\"sql_create\">\n<h3 style=\"color: #000000;\">\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210 CREATE TABLE<\/h3>\n<pre style=\"margin: 20px;\">\r\nCREATE TABLE \u30c6\u30fc\u30d6\u30eb\u540d (\u8ffd\u52a0\u3059\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u540d1 \u30c7\u30fc\u30bf\u578b(\u30b5\u30a4\u30ba),\u8ffd\u52a0\u3059\u308b\u30d5\u30a3\u30fc\u30eb\u30c9\u540d2 \u30c7\u30fc\u30bf\u578b(\u30b5\u30a4\u30ba),...)\r\n\r\n<a href=\"#sql_top\">\u30c8\u30c3\u30d7\u306b\u623b\u308b<\/a>\r\n<\/pre>\n<hr \/>\n<p id=\"sql_select\">\n<h3 style=\"color: #000000;\">\u30ec\u30b3\u30fc\u30c9\u306e\u62bd\u51fa SELECT<\/h3>\n<pre style=\"margin: 20px;\">\r\nSELECT \u62bd\u51fa\u3059\u308b\u5217\u540d1,\u62bd\u51fa\u3059\u308b\u5217\u540d2,...\r\n\u3000 FROM \u62bd\u51fa\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u540d1,\u62bd\u51fa\u5143\u306e\u30c6\u30fc\u30d6\u30eb\u540d2,...\r\n\u3000 WHERE \u62bd\u51fa\u306e\u6761\u4ef6\r\n\r\n\u4f8b\uff1a \r\n<table  class=\" table table-hover\" style=\"font-size:12px;text-align: center;\">\r\n<tr><td colspan=\"4\">\u30c6\u30fc\u30d6\u30eb\u540d\uff1a\u3000\u540d\u524d\u304c\u6c17\u306b\u5165\u3063\u305f\u5143\u7d20<\/td><\/tr>\r\n<tr><td>ID<\/td><td>\u6295\u7a3f\u8005<\/td><td>\u984c\u540d<\/td><td>\u8a73\u7d30<\/td><\/tr>\r\n<tr><td>1<\/td><td>hogehoge<\/td><td>\u30af\u30ed\u30e0<\/td><td>24\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<tr><td>2<\/td><td>somebody<\/td><td>\u30a4\u30f3\u30b8\u30a6\u30e0<\/td><td>49\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<tr><td>3<\/td><td>smoooth<\/td><td>\u30bf\u30f3\u30bf\u30eb<\/td><td>73\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<tr><td>4<\/td><td>screan<\/td><td>\u30ec\u30cb\u30a6\u30e0<\/td><td>75\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<tr><td>5<\/td><td>administrator<\/td><td>\u30d7\u30ed\u30c8\u30a2\u30af\u30c1\u30cb\u30a6\u30e0<\/td><td>91\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<\/table>\r\n\u306b\u5bfe\u3057\u3066\u3001\r\nSELECT \u984c\u540d,\u8a73\u7d30 FROM \u540d\u524d\u304c\u6c17\u306b\u5165\u3063\u305f\u5143\u7d20\r\n\u3000 WHERE  ID >= 2 AND ID <= 4;\r\n\u306e\u30af\u30a8\u30ea\u3092\u4f7f\u3046\u3068\u3001\r\n<table  class=\" table table-hover\" style=\"font-size:12px;text-align: center;\">\r\n<tr><td colspan=\"4\">\u30c6\u30fc\u30d6\u30eb\u540d\uff1a\u3000\u540d\u524d\u304c\u6c17\u306b\u5165\u3063\u305f\u5143\u7d20<\/td><\/tr>\r\n<tr><td>\u984c\u540d<\/td><td>\u8a73\u7d30<\/td><\/tr>\r\n<tr><td>\u30a4\u30f3\u30b8\u30a6\u30e0<\/td><td>49\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<tr><td>\u30bf\u30f3\u30bf\u30eb<\/td><td>73\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<tr><td>\u30ec\u30cb\u30a6\u30e0<\/td><td>75\u756a\u76ee\u306e\u5143\u7d20<\/td><\/tr>\r\n<\/table>\r\n\u304c\u62bd\u51fa\u3067\u304d\u308b\u3002\r\n\u89e3\u8aac\uff1a\r\nSELECT \u984c\u540d,\u8a73\u7d30 FROM \u540d\u524d\u304c\u6c17\u306b\u5165\u3063\u305f\u5143\u7d20\r\n\u3000 WHERE  ID >= 2 AND ID <= 4;\r\n\u3068\u3059\u308b\u3068\u3001 \u540d\u524d\u304c\u6c17\u306b\u5165\u3063\u305f\u5143\u7d20\u3000\u3068\u3044\u3046\u540d\u524d\u306e\u30c6\u30fc\u30d6\u30eb\u5185\u306e\u3001\u3000ID\u304c2\u304b\u30894\u306e\u7bc4\u56f2\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u62bd\u51fa\u3055\u308c\u3001\r\n\u305d\u306e\u3046\u3061\u306e \u984c\u540d , \u8a73\u7d30 \u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u308b\u3002\r\n\r\n\u3061\u306a\u307f\u306b\u3001SELECT * FROM \u540d\u524d\u304c\u6c17\u306b\u5165\u3063\u305f\u5143\u7d20\r\n\u306e\u3088\u3046\u306b\u3001\u3000\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u30a2\u30b9\u30bf\u30ea\u30b9\u30af\u306b\u3059\u308b\u3068\u5168\u3066\u62bd\u51fa\u3068\u306a\u308b\u3002\r\n\r\n<a href=\"#sql_top\">\u30c8\u30c3\u30d7\u306b\u623b\u308b<\/a>\r\n<\/pre>\n<hr \/>\n<p id=\"sql_insertinto\">\n<h3 style=\"color: #000000;\">\u30ec\u30b3\u30fc\u30c9\u306e\u8ffd\u52a0 INSERT INTO<\/h3>\n<pre style=\"margin: 20px;\">INSERT INTO \u30c6\u30fc\u30d6\u30eb\u540d (\u8ffd\u52a0\u3059\u308b\u5217\u540d1,\u8ffd\u52a0\u3059\u308b\u5217\u540d2,...)\r\nVALUE ('\u5217\uff11\u306b\u8ffd\u52a0\u3059\u308b\u5024','\u5217\uff12\u306b\u8ffd\u52a0\u3059\u308b\u5024',...)\r\n\r\n\u00a0\u4f8b\uff1a\u00a0 test_table\u3000 (\u30ec\u30b3\u30fc\u30c9\u306f\u4f55\u3082\u306a\u3044\uff09\r\n<table  class=\" table table-hover\" border=\"1\" width=\"350\" height=\"84\" style=\"font-size:12px;text-align: center;\">\r\n<tbody>\r\n<tr>\r\n<td style=\"text-align: center;\">\u30d5\u30a3\u30fc\u30eb\u30c9<\/td>\r\n<td style=\"text-align: center;\">\u7a2e\u5225\uff08\u30c7\u30fc\u30bf\u578b)<\/td>\r\n<td style=\"text-align: center;\">\u7167\u5408\u9806\u5e8f<\/td>\r\n<td style=\"text-align: center;\">\u305d\u306e\u4ed6<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"text-align: center;\">id<\/td>\r\n<td style=\"text-align: center;\">INT<\/td>\r\n<td><\/td>\r\n<td style=\"text-align: center;\">auto_increment<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"text-align: center;\">title<\/td>\r\n<td style=\"text-align: center;\">varchar<\/td>\r\n<td style=\"text-align: center;\">utf8_bin<\/td>\r\n<td><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"text-align: center;\">desc<\/td>\r\n<td style=\"text-align: center;\">varchar<\/td>\r\n<td style=\"text-align: center;\">utf8_bin<\/td>\r\n<td><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nINSERT INTO test_table ('title','desc')\r\nVALUE('\u3067\u3063\u3066\u3044\u3046','\u7dd1\u306e\u60aa\u9b54')\r\n\r\n<table  class=\" table table-hover\" border=\"1\" width=\"350\" height=\"44\">\r\n<tbody>\r\n<tr>\r\n<td style=\"text-align: center;\">id<\/td>\r\n<td style=\"text-align: center;\">title<\/td>\r\n<td style=\"text-align: center;\">desc<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"text-align: center;\">1<\/td>\r\n<td style=\"text-align: center;\">\u3067\u3063\u3066\u3044\u3046<\/td>\r\n<td style=\"text-align: center;\">\u7dd1\u306e\u60aa\u9b54<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<a href=\"#sql_top\">\u30c8\u30c3\u30d7\u306b\u623b\u308b<\/a><\/pre>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u3044\u305d\u3046\u306aSQL\u6587\u3092\u30e1\u30e2\u308b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6],"tags":[],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-sql","category-6"],"_links":{"self":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34"}],"version-history":[{"count":49,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":213,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions\/213"}],"wp:attachment":[{"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nukoneko.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}