{"id":5910,"date":"2025-11-27T15:13:30","date_gmt":"2025-11-27T06:13:30","guid":{"rendered":"https:\/\/www.bold.ne.jp\/engineer-club\/?p=5910"},"modified":"2025-11-27T15:12:28","modified_gmt":"2025-11-27T06:12:28","slug":"sqlupdate2","status":"publish","type":"post","link":"https:\/\/www.bold.ne.jp\/engineer-club\/sqlupdate2","title":{"rendered":"SQL\u306eUPDATE\u6587\u3001\u57fa\u672c\u304b\u3089\u8907\u6570\u30c6\u30fc\u30d6\u30eb\u53c2\u7167\u307e\u3067\u3092\u8a73\u3057\u304f\u3054\u7d39\u4ecb"},"content":{"rendered":"<p>SQL\u306b\u304a\u3051\u308b\u30c7\u30fc\u30bf\u64cd\u4f5c\u8a00\u8a9e (DML)\u306e1\u3064\u3067\u3001\u30c6\u30fc\u30d6\u30eb\u5185\u306e\u30c7\u30fc\u30bf\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b\u3068\u304d\u306b\u4f7f\u3046\u547d\u4ee4\u304cUPDATE\u6587\u3067\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u57fa\u672c\u306b\u7acb\u3061\u8fd4\u308a\u3001\u8a08\u7b97\u5f0f\u3001case\u5f0f\u3001\u8907\u6570\u30c6\u30fc\u30d6\u30eb\u306e\u53d6\u308a\u6271\u3044\u306b\u3064\u3044\u3066\u3001\u8aac\u660e\u3057\u3066\u884c\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#SQLUPDATE\">\uff11\uff0eSQL\u306eUPDATE\u6587\u3068\u306f\uff1f<\/a><ul><li><a href=\"#-SQL\">\uff11-\uff11\uff0e\u30c7\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u305f\u5024\u3067\u4e0a\u66f8\u304d\u3059\u308bSQL\u6587<\/a><\/li><li><a href=\"#i\">\uff11-\uff12\uff0e\u672c\u8a18\u4e8b\u3067\u4f7f\u7528\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf<\/a><\/li><\/ul><\/li><li><a href=\"#UPDATE\">\uff12\uff0e\u57fa\u672c\u7684\u306aUPDATE\u6587\u306e\u4f7f\u3044\u65b9<\/a><ul><li><a href=\"#i-2\">\uff12-\uff11\uff0e\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b<\/a><\/li><li><a href=\"#-WHERE\">\uff12-\uff12\uff0eWHERE\u53e5\u3067\u6761\u4ef6\u306b\u5f53\u3066\u306f\u307e\u308b\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b<\/a><\/li><li><a href=\"#-SET\">\uff12-\uff13\uff0eSET\u53e5\u3067\u7c21\u5358\u306a\u8a08\u7b97\u304c\u3067\u304d\u308b<\/a><\/li><li><a href=\"#i-3\">\uff12-\uff14\uff0e\u30c7\u30fc\u30bf\u306b\u5fdc\u3058\u3066\u66f4\u65b0\u3059\u308b\u5024\u3092\u5909\u3048\u308b<\/a><\/li><li><a href=\"#i-4\">\uff12-\uff15\uff0e\u7a7a\u3063\u307d\u306e\u5024\u3067\u66f4\u65b0\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#UPDATE-2\">\uff13\uff0e\u5fdc\u7528\u7684\u306aUPDATE\u6587\u306e\u4f7f\u3044\u65b9<\/a><ul><li><a href=\"#i-5\">\uff13-\uff11\uff0e\u4ed6\u306e\u8868\u304b\u3089\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u66f4\u65b0\u3059\u308b<\/a><\/li><\/ul><\/li><li><a href=\"#i-6\">\uff14\uff0e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5225\u306e\u66f8\u304d\u65b9\u3092\u7d39\u4ecb<\/a><ul><li><a href=\"#-SQLANSIISO\">\uff14-\uff11\uff0e\u6a19\u6e96SQL\uff08ANSI\/ISO\uff09\u306e\u5834\u5408<\/a><\/li><li><a href=\"#-Oracle\">\uff14-\uff12\uff0eOracle\u306e\u5834\u5408<\/a><\/li><li><a href=\"#-MySQL\">\uff14-\uff13\uff0eMySQL\u306e\u5834\u5408<\/a><\/li><li><a href=\"#-SQL_Server\">\uff14-\uff14\uff0eSQL Server\u306e\u5834\u5408<\/a><\/li><li><a href=\"#-PostgreSQL\">\uff14-\uff15\uff0ePostgreSQL\u306e\u5834\u5408<\/a><\/li><\/ul><\/li><li><a href=\"#i-7\">\uff15\uff0e\u4ed6\u306e\u8868\u3092\u53c2\u7167\u3059\u308b\u6642\u306b\u767a\u751f\u3057\u3084\u3059\u3044\u30a8\u30e9\u30fc<\/a><\/li><li><a href=\"#i-8\">\uff16\uff0e\u3055\u3044\u3054\u306b<\/a><\/li><\/ul><\/div>\n<h2><span id=\"SQLUPDATE\">\uff11\uff0eSQL\u306eUPDATE\u6587\u3068\u306f\uff1f<\/span><\/h2>\n<p>UPDATE\u6587\u306f\uff11\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u5185\u306e\uff11\u30ec\u30b3\u30fc\u30c9\u3001\u307e\u305f\u306f\u8907\u6570\u30ec\u30b3\u30fc\u30c9\u306e\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3059\u308b\u6587\u3067\u3059\u3002<br \/>\n\u5168\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u66f4\u65b0\u3059\u308b\u3053\u3068\u3082\u3001\u6761\u4ef6\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u3092\u9078\u629e\u3057\u3066\u66f4\u65b0\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3><span id=\"-SQL\">\uff11-\uff11\uff0e\u30c7\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u305f\u5024\u3067\u4e0a\u66f8\u304d\u3059\u308bSQL\u6587<\/span><\/h3>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u30c6\u30fc\u30d6\u30eb\u540d\r\n   SET \u5217\u540d = \u5909\u66f4\u5185\u5bb9, ...\r\n WHERE \u6761\u4ef6\u5f0f;\r\n<\/pre>\n<p>\u300c\u30c6\u30fc\u30d6\u30eb\u540d\u300d\u306f\u3001\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u300c\u5217\u540d = \u5909\u66f4\u5185\u5bb9\u300d\u306f\u3001\u5909\u66f4\u5bfe\u8c61\u306e\u5217\uff08\u300c\u5217\u540d\u300d\uff09\u3092\u3069\u306e\u3088\u3046\u306b\u5909\u66f4\u3059\u308b\u304b\uff08\u300c\u5909\u66f4\u5185\u5bb9\u300d\uff09\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u300c\u5217\u540d = \u5909\u66f4\u5185\u5bb9\u300d\u3092\u30ab\u30f3\u30de\u3067\u533a\u5207\u3063\u3066\u3001\u8907\u6570\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u300c\u5217\u540d\u300d\u3067\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5217\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u300c\u6761\u4ef6\u5f0f\u300d\u306f\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3059\u308b\u30ec\u30b3\u30fc\u30c9\u3092\u7d5e\u308a\u8fbc\u3080\u305f\u3081\u306e\u5f0f\u3067\u3059\u3002\u6307\u5b9a\u306e\u4ed5\u65b9\u306fSELECT\u6587\u3068\u540c\u69d8\u3067\u3059\u3002<\/p>\n<h3><span id=\"i\">\uff11-\uff12\uff0e\u672c\u8a18\u4e8b\u3067\u4f7f\u7528\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf<\/span><\/h3>\n<p>SQL\u3092\u8aac\u660e\u3059\u308b\u306b\u5f53\u305f\u3063\u3066\u3001\u7406\u89e3\u3057\u3084\u3059\u3044\u3088\u3046\u306b\u6b21\u306e\u56f3\u306e\u3088\u3046\u306a\u30e2\u30c7\u30eb\u30b1\u30fc\u30b9\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u3053\u3053\u304b\u3089\u5148\u306f\u3001\u5177\u4f53\u4f8b\u3084\u4f7f\u7528\u4f8b\u306a\u3069\u3092\u8aac\u660e\u3059\u308b\u969b\u306b\u3001\u3053\u306e\u30e2\u30c7\u30eb\u30b1\u30fc\u30b9\u306e\u7528\u8a9e\u3084\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2025\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-10-08-163547.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2025\/10\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2025-10-08-163547.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2025-10-08 163547\" width=\"281\" height=\"121\" class=\"alignnone size-full wp-image-5911\" \/><\/a><\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"height: 90px; width: 24.4322%; border-collapse: collapse; border-style: outset;\" height=\"82\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 7.70621%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 12.8617%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 11.6335%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 7.70621%; height: 21px;\">S01<\/td>\n<td style=\"width: 12.8617%; height: 21px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 11.6335%; height: 21px;\">150<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 7.70621%; height: 21px;\">S02<\/td>\n<td style=\"width: 12.8617%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 11.6335%; height: 21px;\">80<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 7.70621%; height: 24px;\">S03<\/td>\n<td style=\"width: 12.8617%; height: 24px;\">\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 11.6335%; height: 24px;\">200<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d0d\u54c1<\/p>\n<table style=\"height: 124px; width: 50.6865%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50%; height: 21px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D01<\/td>\n<td style=\"width: 50%; height: 21px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D02<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D03<\/td>\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d0d\u54c1\u660e\u7d30<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset; height: 131px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 20%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D01<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C01<\/td>\n<td style=\"width: 20%; height: 24px;\">10<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D02<\/td>\n<td style=\"width: 20%; height: 21px;\">1<\/td>\n<td style=\"width: 20%; height: 21px;\">S01<\/td>\n<td style=\"width: 20%; height: 21px;\">C02<\/td>\n<td style=\"width: 20%; height: 21px;\">30<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D02<\/td>\n<td style=\"width: 20%; height: 21px;\">2<\/td>\n<td style=\"width: 20%; height: 21px;\">S02<\/td>\n<td style=\"width: 20%; height: 21px;\">C02<\/td>\n<td style=\"width: 20%; height: 21px;\">20<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D03<\/td>\n<td style=\"width: 20%; height: 21px;\">1<\/td>\n<td style=\"width: 20%; height: 21px;\">S02<\/td>\n<td style=\"width: 20%; height: 21px;\">C03<\/td>\n<td style=\"width: 20%; height: 21px;\">40<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 20%; height: 20px;\">D03<\/td>\n<td style=\"width: 20%; height: 20px;\">2<\/td>\n<td style=\"width: 20%; height: 20px;\">S03<\/td>\n<td style=\"width: 20%; height: 20px;\">C03<\/td>\n<td style=\"width: 20%; height: 20px;\">60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span id=\"UPDATE\">\uff12\uff0e\u57fa\u672c\u7684\u306aUPDATE\u6587\u306e\u4f7f\u3044\u65b9<\/span><\/h2>\n<p>\u307e\u305a\u306f\u3001\u57fa\u672c\u7684\u306aUPDATE\u6587\u306e\u4f7f\u3044\u65b9\u3092\u5b66\u7fd2\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3><span id=\"i-2\">\uff12-\uff11\uff0e\u3059\u3079\u3066\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b<\/span><\/h3>\n<p>\u300cWHERE \u6761\u4ef6\u5f0f\u300d\u3092\u307e\u3063\u305f\u304f\u6307\u5b9a\u3057\u306a\u3044\u3068\u3001\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u5909\u66f4\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = 100;\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001&#8221;\u5546\u54c1&#8221;\u8868\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u3059\u3079\u3066\u306e\u5024\u306f100\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\n\u5b9f\u884c\u5f8c\u306b\u691c\u7d22\u3092\u3059\u308b\u3068\u3001&#8221;\u5546\u54c1&#8221;\u8868\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 69.8192%; border-collapse: collapse; border-style: outset; height: 129px;\">\n<tbody>\n<tr style=\"height: 20px;\">\n<td style=\"width: 33.3333%; height: 20px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">100<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">100<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 33.3333%; height: 20px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span id=\"-WHERE\">\uff12-\uff12\uff0eWHERE\u53e5\u3067\u6761\u4ef6\u306b\u5f53\u3066\u306f\u307e\u308b\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b<\/span><\/h3>\n<p>\u300cWHERE \u6761\u4ef6\u5f0f\u300d\u306e\u6761\u4ef6\u5f0f\u306b\u6761\u4ef6\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306e\u30c7\u30fc\u30bf\u304c\u5909\u66f4\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u7d9a\u3051\u3066\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = 170\r\n WHERE \u5546\u54c1ID = 'S01';\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1ID&#8217;S01&#8217;\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306f170\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u5546\u54c1&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 70.0974%; border-collapse: collapse; border-style: outset; height: 93px;\" height=\"147\">\n<tbody>\n<tr style=\"height: 25px;\">\n<td style=\"width: 33.3333%; height: 25px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 25px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 25px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 33.3333%; height: 23px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 23px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 23px;\">170<\/td>\n<\/tr>\n<tr style=\"height: 23px;\">\n<td style=\"width: 33.3333%; height: 23px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 23px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 23px;\">100<\/td>\n<\/tr>\n<tr style=\"height: 22px;\">\n<td style=\"width: 33.3333%; height: 22px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 22px;\">\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 22px;\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u5546\u54c1ID = &#8216;S01&#8217;\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306f\uff11\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u306a\u306e\u3067\u3001&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u306f\u3001\uff11\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u8907\u6570\u306e\u5217\u3092\u540c\u6642\u306b\u66f4\u65b0\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\u3055\u3089\u306b\u7d9a\u3051\u3066\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = 250,\r\n       \u5546\u54c1\u540d = '\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7'\r\n WHERE \u5546\u54c1ID = 'S03';\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1ID&#8217;S03&#8217;\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306f250\u3001&#8221;\u5546\u54c1\u540d&#8221;\u5217\u306e\u5024\u306f&#8217;\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7&#8217;\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u5546\u54c1&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 69.8192%; border-collapse: collapse; border-style: outset; height: 87px;\" height=\"138\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 22px;\">\n<td style=\"width: 33.3333%; height: 22px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 22px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 22px;\">170<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">100<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 33.3333%; height: 20px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">250<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u5546\u54c1ID = &#8216;S03&#8217;\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306f\uff13\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u306a\u306e\u3067\u3001&#8221;\u4fa1\u683c&#8221;\u5217\u3068&#8221;\u5546\u54c1\u540d&#8221;\u5217\u306e\u5024\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u306f\u3001\uff13\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u300c\u6761\u4ef6\u5f0f\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u304c\uff11\u3064\u3082\u306a\u3044\u5834\u5408\u306b\u306f\u3001\u3069\u306e\u30ec\u30b3\u30fc\u30c9\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u3055\u3089\u306b\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = 900\r\n WHERE \u5546\u54c1ID = 'S99';\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u3082\u3001\u300c\u5546\u54c1ID = &#8216;S09&#8217;\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u304c\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u5024\u306f\u5b9f\u884c\u524d\u3068\u540c\u3058\u3067\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u5546\u54c1&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u3001\u5909\u66f4\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 73.5744%; border-collapse: collapse; border-style: outset; height: 93px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">170<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">100<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 33.3333%; height: 20px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">250<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u306a\u304a\u3001\u3053\u306e\u3088\u3046\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u304c\uff11\u3064\u3082\u306a\u3044\u6761\u4ef6\u5f0f\u3092\u6307\u5b9a\u3057\u3066\u3082\u3001\u30a8\u30e9\u30fc\u306f\u767a\u751f\u3057\u307e\u305b\u3093\u3002<\/p>\n<h3><span id=\"-SET\">\uff12-\uff13\uff0eSET\u53e5\u3067\u7c21\u5358\u306a\u8a08\u7b97\u304c\u3067\u304d\u308b<\/span><\/h3>\n<p>\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306b\u306f\u8a08\u7b97\u5f0f\u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\uff11\uff0d\uff14\u306b\u7d9a\u3044\u3066\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = \u4fa1\u683c * 1.2\r\n WHERE \u5546\u54c1ID = 'S02';\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1ID&#8217;S02&#8217;\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306f\u5909\u66f4\u524d\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306e1.2\u500d\u3001\u5373\u3061120\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u5546\u54c1&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 64.276%; border-collapse: collapse; border-style: outset; height: 135px;\" height=\"126\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">170<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">120<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">250<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u5546\u54c1ID = &#8216;S02&#8217;\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306f\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u306a\u306e\u3067\u3001&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u306f\u3001\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3059\u3002<\/p>\n<h3><span id=\"i-3\">\uff12-\uff14\uff0e\u30c7\u30fc\u30bf\u306b\u5fdc\u3058\u3066\u66f4\u65b0\u3059\u308b\u5024\u3092\u5909\u3048\u308b<\/span><\/h3>\n<p>\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306b\u306f\u6761\u4ef6\u5206\u5c90(CASE\u5f0f)\u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u7d0d\u54c1\u6570 = CASE\r\n                  WHEN \u7d0d\u54c1\u6570 &gt; 30 THEN \u7d0d\u54c1\u6570 + 5\r\n                  ELSE \u7d0d\u54c1\u6570 + 3\r\n                END\r\n WHERE \u5546\u54c1ID = 'S02';\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1ID&#8217;S02&#8217;\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u306f\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u304c30\u3088\u308a\u5927\u304d\u3044\u5834\u5408\u306f\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\uff0b\uff15\u3001\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u306f\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\uff0b\uff13\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7d0d\u54c1\u660e\u7d30<\/p>\n<table style=\"width: 90.8206%; border-collapse: collapse; border-style: outset; height: 144px;\" height=\"188\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 20%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D01<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C01<\/td>\n<td style=\"width: 20%; height: 24px;\">10<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D02<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C02<\/td>\n<td style=\"width: 20%; height: 24px;\">30<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D02<\/td>\n<td style=\"width: 20%; height: 24px;\">2<\/td>\n<td style=\"width: 20%; height: 24px;\">S02<\/td>\n<td style=\"width: 20%; height: 24px;\">C02<\/td>\n<td style=\"width: 20%; height: 24px;\">23<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D03<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S02<\/td>\n<td style=\"width: 20%; height: 24px;\">C03<\/td>\n<td style=\"width: 20%; height: 24px;\">45<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D03<\/td>\n<td style=\"width: 20%; height: 24px;\">2<\/td>\n<td style=\"width: 20%; height: 24px;\">S03<\/td>\n<td style=\"width: 20%; height: 24px;\">C03<\/td>\n<td style=\"width: 20%; height: 24px;\">60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u5546\u54c1ID = &#8216;S02&#8217;\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306f\uff13\u884c\u76ee\u3068\uff14\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3067\u3001&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u306f\u3001\uff13\u884c\u76ee\u3068\uff14\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3059\u3002\uff13\u884c\u76ee\u306e\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u306f20\u306a\u306e\u3067\u3001\u5909\u66f4\u5f8c\u306f\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\uff0b\uff13\u3001\u5373\u306123\u3068\u306a\u308a\u307e\u3059\u3002\uff14\u884c\u76ee\u306e\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u306f40\u306a\u306e\u3067\u3001\u5909\u66f4\u5f8c\u306f\u5909\u66f4\u524d\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\uff0b\uff15\u3001\u5373\u306145\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3><span id=\"i-4\">\uff12-\uff15\uff0e\u7a7a\u3063\u307d\u306e\u5024\u3067\u66f4\u65b0\u3059\u308b<\/span><\/h3>\n<p>\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306bNULL\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\u7d9a\u3051\u3066\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u7d0d\u54c1\u6570 = NULL\r\n WHERE \u5546\u54c1ID = 'S03';\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1ID&#8217;S03&#8217;\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u306fNULL\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7d0d\u54c1\u660e\u7d30<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset; height: 122px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 20%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D01<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C01<\/td>\n<td style=\"width: 20%; height: 24px;\">10<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D02<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C02<\/td>\n<td style=\"width: 20%; height: 24px;\">30<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D02<\/td>\n<td style=\"width: 20%; height: 24px;\">2<\/td>\n<td style=\"width: 20%; height: 24px;\">S02<\/td>\n<td style=\"width: 20%; height: 24px;\">C02<\/td>\n<td style=\"width: 20%; height: 24px;\">23<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D03<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S02<\/td>\n<td style=\"width: 20%; height: 24px;\">C03<\/td>\n<td style=\"width: 20%; height: 24px;\">45<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D03<\/td>\n<td style=\"width: 20%; height: 24px;\">2<\/td>\n<td style=\"width: 20%; height: 24px;\">S03<\/td>\n<td style=\"width: 20%; height: 24px;\">C03<\/td>\n<td style=\"width: 20%; height: 24px;\">NULL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5546\u54c1ID = &#8216;S03&#8217;\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306f\uff15\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u306a\u306e\u3067\u3001&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u304cNULL\u3067\u66f4\u65b0\u3055\u308c\u308b\u306e\u306f\u3001\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3059\u3002<\/p>\n<h2><span id=\"UPDATE-2\">\uff13\uff0e\u5fdc\u7528\u7684\u306aUPDATE\u6587\u306e\u4f7f\u3044\u65b9<\/span><\/h2>\n<p>\u526f\u554f\u3044\u5408\u308f\u305b\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u5225\u8868\u306e\u5024\u3092\u6761\u4ef6\u306b\u6307\u5b9a\u3057\u305f\u308a\u3001\u5225\u30c6\u30fc\u30d6\u30eb\u306e\u5024\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u305d\u308c\u305e\u308c\u5177\u4f53\u4f8b\u3092\u4e0a\u3052\u306a\u304c\u3089\u3001\u5fdc\u7528\u7684\u306aUPDATE\u6587\u306e\u4f7f\u3044\u65b9\u3092\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3><span id=\"i-5\">\uff13-\uff11\uff0e\u4ed6\u306e\u8868\u304b\u3089\u60c5\u5831\u3092\u53d6\u5f97\u3057\u3066\u66f4\u65b0\u3059\u308b<\/span><\/h3>\n<p>\u300cWHERE \u6761\u4ef6\u5f0f\u300d\u306e\u300c\u6761\u4ef6\u5f0f\u300d\u306b\u526f\u554f\u3044\u5408\u308f\u305b\u3092\u4f7f\u3046\u3053\u3068\u3067\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u53c2\u7167\u3059\u308b\u6761\u4ef6\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n\uff11\uff0d\uff12\u3067\u6700\u521d\u306b\u3042\u3052\u305f\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306b\u623b\u3063\u3066\u3001\u8a71\u3092\u9032\u3081\u307e\u3057\u3087\u3046\u3002\uff11\uff0d\uff12\u306e\u30c7\u30fc\u30bf\u306f\u6b21\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 76.087%; border-collapse: collapse; border-style: outset; height: 86px;\" height=\"143\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">150<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">80<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 33.3333%; height: 20px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">200<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d0d\u54c1<\/p>\n<table style=\"width: 52.0595%; border-collapse: collapse; border-style: outset; height: 139px;\" height=\"122\">\n<tbody>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50%; height: 21px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D01<\/td>\n<td style=\"width: 50%; height: 21px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D02<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D03<\/td>\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d0d\u54c1\u660e\u7d30<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 20%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D01<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C01<\/td>\n<td style=\"width: 20%; height: 24px;\">10<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D02<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C02<\/td>\n<td style=\"width: 20%; height: 24px;\">30<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D02<\/td>\n<td style=\"width: 20%; height: 24px;\">2<\/td>\n<td style=\"width: 20%; height: 24px;\">S02<\/td>\n<td style=\"width: 20%; height: 24px;\">C02<\/td>\n<td style=\"width: 20%; height: 24px;\">20<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D03<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S02<\/td>\n<td style=\"width: 20%; height: 24px;\">C03<\/td>\n<td style=\"width: 20%; height: 24px;\">40<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D03<\/td>\n<td style=\"width: 20%; height: 24px;\">2<\/td>\n<td style=\"width: 20%; height: 24px;\">S03<\/td>\n<td style=\"width: 20%; height: 24px;\">C03<\/td>\n<td style=\"width: 20%; height: 24px;\">60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u3048\u3070\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = \u4fa1\u683c * 1.1\r\n WHERE \u5546\u54c1ID IN (\r\n         SELECT \u5546\u54c1ID\r\n           FROM \u7d0d\u54c1\u660e\u7d30\r\n          WHERE \u7d0d\u54c1\u6570 &lt; 30\r\n       );<\/pre>\n<p>&#8220;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306e&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u304c30\u672a\u6e80\u3068\u306a\u308b\u3088\u3046\u306a\u5546\u54c1ID\u3068\u4e00\u81f4\u3059\u308b&#8221;\u5546\u54c1&#8221;\u8868\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306f\u5909\u66f4\u524d\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306e1.1\u500d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4e00\u3064\u305a\u3064\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT \u5546\u54c1ID\r\n  FROM \u7d0d\u54c1\u660e\u7d30\r\n WHERE \u7d0d\u54c1\u6570 &lt; 30<\/pre>\n<p>\u3053\u306eSELECT\u6587\u3067\u53d6\u5f97\u3055\u308c\u308b\u5546\u54c1ID\u306e\u4e00\u89a7\u306f&#8217;S01&#8217;\u3068&#8217;S02&#8217;\u3067\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u4ee5\u4e0b\u306eUPDATE\u6587\u3068\u540c\u3058\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = \u4fa1\u683c * 1.1\r\n WHERE \u5546\u54c1ID IN ('S01', 'S02');\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1ID&#8217;S01&#8217;\u3068&#8217;S02&#8217;\u306e&#8221;\u5546\u54c1&#8221;\u8868\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306f\u5909\u66f4\u524d\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306e1.1\u500d\u3001\u5373\u3061\u305d\u308c\u305e\u308c165\u306888\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u5546\u54c1&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 63.4201%; border-collapse: collapse; border-style: outset;\" height=\"140\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.3333%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S01<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">165<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 33.3333%; height: 21px;\">S02<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.3333%; height: 21px;\">88<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 33.3333%; height: 20px;\">S03<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.3333%; height: 20px;\">200<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u5546\u54c1ID IN (&#8216;S01&#8217;, &#8216;S02&#8217;)\u300d\u306b\u5f53\u3066\u306f\u307e\u308b\u30ec\u30b3\u30fc\u30c9\u306f\uff11\u884c\u76ee\u3068\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3060\u3051\u306a\u306e\u3067\u3001&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u304c\u66f4\u65b0\u3055\u308c\u308b\u306e\u306f\u3001\uff11\u884c\u76ee\u3068\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u540c\u3058\u66f4\u65b0\u51e6\u7406\u3092\u884c\u3046UPDATE\u6587\u306e\u66f8\u304d\u65b9\u306f\u4ed6\u306b\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n\u4e0a\u8a18UPDATE\u6587\u3067\u306f\u3001IN\u53e5\u3092\u4f7f\u3044\u307e\u3057\u305f\u304c\u3001EXISTS\u53e5\u3092\u4f7f\u3063\u3066\u6b21\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u5546\u54c1\r\n   SET \u4fa1\u683c = \u4fa1\u683c * 1.1\r\n WHERE EXISTS (\r\n         SELECT 1\r\n           FROM \u7d0d\u54c1\u660e\u7d30\r\n          WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n            AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = \u5546\u54c1.\u5546\u54c1ID\r\n       );<\/pre>\n<p>\u3053\u3061\u3089\u3082\u4e00\u3064\u305a\u3064\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u66f4\u65b0\u5bfe\u8c61\u306e\u5019\u88dc\u3068\u3057\u3066&#8221;\u5546\u54c1&#8221;\u8868\u306e\uff11\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u53d6\u308a\u51fa\u3055\u308c\u305f\u3068\u3057\u307e\u3059\u3002\u5546\u54c1ID&#8217;S01&#8217;\u3067\u3059\u3002\u6b21\u306eSELECT\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT 1\r\n  FROM \u7d0d\u54c1\u660e\u7d30\r\n WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n   AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = 'S01'<\/pre>\n<p>&#8220;\u7d0d\u54c1&#8221;\u8868\u306b&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u304c30\u672a\u6e80\u4e14\u3064\u5546\u54c1ID\u304c&#8217;S01&#8217;\u306e\u884c\u304c\uff11\u884c\u76ee\u306b\u3042\u308a\u3001\u691c\u7d22\u7d50\u679c\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306eEXISTS\u53e5\u306e\u7d50\u679c\u306f\u771f(TRUE)\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">EXISTS (\r\n  SELECT 1\r\n    FROM \u7d0d\u54c1\u660e\u7d30\r\n   WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n     AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = \u5546\u54c1.\u5546\u54c1ID<\/pre>\n<p>\u3088\u3063\u3066\u3001&#8221;\u5546\u54c1&#8221;\u8868\u306e\u5546\u54c1ID&#8217;S01&#8217;\u306f\u66f4\u65b0\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u66f4\u65b0\u5bfe\u8c61\u306e\u5019\u88dc\u3068\u3057\u3066&#8221;\u5546\u54c1&#8221;\u8868\u306e\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u53d6\u308a\u51fa\u3055\u308c\u305f\u3068\u3057\u307e\u3059\u3002\u5546\u54c1ID&#8217;S02&#8217;\u3067\u3059\u3002\u6b21\u306eSELECT\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT 1\r\n  FROM \u7d0d\u54c1\u660e\u7d30\r\n WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n   AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = 'S02'<\/pre>\n<p>&#8220;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306b&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u304c30\u672a\u6e80\u4e14\u3064\u5546\u54c1ID\u304c&#8217;S02&#8217;\u306e\u884c\u304c\uff13\u884c\u76ee\u306b\u3042\u308a\u3001\u691c\u7d22\u7d50\u679c\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306eEXISTS\u53e5\u306e\u7d50\u679c\u306f\u771f(TRUE)\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">EXISTS (\r\n  SELECT 1\r\n    FROM \u7d0d\u54c1\u660e\u7d30\r\n   WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n     AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = \u5546\u54c1.\u5546\u54c1ID\r\n)<\/pre>\n<p>\u3088\u3063\u3066\u3001&#8221;\u5546\u54c1&#8221;\u8868\u306e\u5546\u54c1ID&#8217;S02&#8217;\u3082\u66f4\u65b0\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u66f4\u65b0\u5bfe\u8c61\u306e\u5019\u88dc\u3068\u3057\u3066&#8221;\u5546\u54c1&#8221;\u8868\u306e\uff13\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u53d6\u308a\u51fa\u3055\u308c\u305f\u3068\u3057\u307e\u3059\u3002\u5546\u54c1ID&#8217;S03&#8217;\u3067\u3059\u3002\u6b21\u306eSELECT\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT 1\r\n  FROM \u7d0d\u54c1\u660e\u7d30\r\n WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n   AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = 'S03'<\/pre>\n<p>&#8220;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306b&#8221;\u7d0d\u54c1\u6570&#8221;\u5217\u306e\u5024\u304c30\u672a\u6e80\u4e14\u3064\u5546\u54c1ID\u304c&#8217;S03&#8217;\u306e\u884c\u304c\u306a\u304f\u3001\u691c\u7d22\u7d50\u679c\u304c\u5b58\u5728\u3057\u306a\u3044\u306e\u3067\u3001\u4ee5\u4e0b\u306eEXISTS\u53e5\u306e\u7d50\u679c\u306f\u507d(FALSE)\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"prettyprint lang:default decode:true\">EXISTS (\r\n  SELECT 1\r\n    FROM \u7d0d\u54c1\u660e\u7d30\r\n   WHERE \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1\u6570 &lt; 30\r\n     AND \u7d0d\u54c1\u660e\u7d30.\u5546\u54c1ID = \u5546\u54c1.\u5546\u54c1ID\r\n)<\/pre>\n<p>\u3088\u3063\u3066\u3001&#8221;\u5546\u54c1&#8221;\u8868\u306e\u5546\u54c1ID&#8217;S03&#8217;\u306f\u66f4\u65b0\u5bfe\u8c61\u3068\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u4ee5\u4e0a\u3092\u307e\u3068\u3081\u308b\u3068\u3001\u5546\u54c1ID&#8217;S01&#8217;\u3068&#8217;S02&#8217;\u304c\u66f4\u65b0\u5bfe\u8c61\u3068\u306a\u308a\u3001\u5546\u54c1ID&#8217;S01&#8217;\u3068&#8217;S02&#8217;\u306e&#8221;\u5546\u54c1&#8221;\u8868\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306f\u5909\u66f4\u524d\u306e&#8221;\u4fa1\u683c&#8221;\u5217\u306e\u5024\u306e1.1\u500d\u3001\u5373\u3061\u305d\u308c\u305e\u308c165\u306888\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2><span id=\"i-6\">\uff14\uff0e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5225\u306e\u66f8\u304d\u65b9\u3092\u7d39\u4ecb<\/span><\/h2>\n<p>\u3053\u308c\u307e\u3067\u300c\u5217\u540d = \u5909\u66f4\u5185\u5bb9\u300d\u306e\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306b\u5b9a\u6570\u3084\u8a08\u7b97\u5f0f\u306a\u3069\u3092\u6307\u5b9a\u3059\u308b\u30b1\u30fc\u30b9\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306b\u76f8\u95a2\u526f\u554f\u3044\u5408\u308f\u305b\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u5024\u3067\u66f4\u65b0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u518d\u3073\u3001\uff11\uff0d\uff12\u3067\u6700\u521d\u306b\u3042\u3052\u305f\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306b\u623b\u3063\u3066\u3001\u8a71\u3092\u9032\u3081\u307e\u3057\u3087\u3046\u3002\uff11\uff0d\uff12\u306e\u30c7\u30fc\u30bf\u306f\u6b21\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u5546\u54c1<\/p>\n<table style=\"width: 60.9287%; border-collapse: collapse; border-style: outset;\" height=\"129\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 17.1768%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 29.2517%; height: 24px;\">\u5546\u54c1\u540d<\/td>\n<td style=\"width: 33.0909%; height: 24px;\">\u4fa1\u683c<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 17.1768%; height: 21px;\">S01<\/td>\n<td style=\"width: 29.2517%; height: 21px;\">\u30dc\u30fc\u30eb\u30da\u30f3<\/td>\n<td style=\"width: 33.0909%; height: 21px;\">150<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 17.1768%; height: 21px;\">S02<\/td>\n<td style=\"width: 29.2517%; height: 21px;\">\u6d88\u3057\u30b4\u30e0<\/td>\n<td style=\"width: 33.0909%; height: 21px;\">80<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 17.1768%; height: 24px;\">S03<\/td>\n<td style=\"width: 29.2517%; height: 24px;\">\u30af\u30ea\u30c3\u30d7<\/td>\n<td style=\"width: 33.0909%; height: 24px;\">200<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d0d\u54c1<\/p>\n<table style=\"width: 39.4111%; border-collapse: collapse; border-style: outset;\" height=\"116\">\n<tbody>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50%; height: 21px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D01<\/td>\n<td style=\"width: 50%; height: 21px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D02<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">D03<\/td>\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7d0d\u54c1\u660e\u7d30<\/p>\n<table style=\"width: 70.3284%; border-collapse: collapse; border-style: outset;\" height=\"192\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 20%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D01<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C01<\/td>\n<td style=\"width: 20%; height: 24px;\">10<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D02<\/td>\n<td style=\"width: 20%; height: 21px;\">1<\/td>\n<td style=\"width: 20%; height: 21px;\">S01<\/td>\n<td style=\"width: 20%; height: 21px;\">C02<\/td>\n<td style=\"width: 20%; height: 21px;\">30<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D02<\/td>\n<td style=\"width: 20%; height: 21px;\">2<\/td>\n<td style=\"width: 20%; height: 21px;\">S02<\/td>\n<td style=\"width: 20%; height: 21px;\">C02<\/td>\n<td style=\"width: 20%; height: 21px;\">20<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D03<\/td>\n<td style=\"width: 20%; height: 21px;\">1<\/td>\n<td style=\"width: 20%; height: 21px;\">S02<\/td>\n<td style=\"width: 20%; height: 21px;\">C03<\/td>\n<td style=\"width: 20%; height: 21px;\">40<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 20%; height: 20px;\">D03<\/td>\n<td style=\"width: 20%; height: 20px;\">2<\/td>\n<td style=\"width: 20%; height: 20px;\">S03<\/td>\n<td style=\"width: 20%; height: 20px;\">C03<\/td>\n<td style=\"width: 20%; height: 20px;\">60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span id=\"-SQLANSIISO\">\uff14-\uff11\uff0e\u6a19\u6e96SQL\uff08ANSI\/ISO\uff09\u306e\u5834\u5408<\/span><\/h3>\n<p>\u4f8b\u3048\u3070\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u9867\u5ba2ID = (\r\n         SELECT \u9867\u5ba2ID\r\n           FROM \u7d0d\u54c1\r\n          WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n       )\r\n WHERE EXISTS (\r\n         SELECT 1\r\n           FROM \u7d0d\u54c1\r\n          WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n       );\r\n<\/pre>\n<p>&#8220;\u7d0d\u54c1&#8221;\u8868\u306e&#8221;\u7d0d\u54c1ID&#8221;\u5217\u306e\u5024\u306b\u5b58\u5728\u3059\u308b&#8221;\u7d0d\u54c1ID&#8221;\u3092\u6301\u3064&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306e&#8221;\u9867\u5ba2ID&#8221;\u5217\u306e\u5024\u3092\u540c\u3058&#8221;\u7d0d\u54c1ID&#8221;\u5217\u306e\u5024\u3092\u6301\u3064&#8221;\u7d0d\u54c1&#8221;\u8868\u306e&#8221;\u9867\u5ba2ID&#8221;\u5217\u306e\u5024\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<br \/>\nUPDATE\u6587\u306e\u5b9f\u884c\u5f8c\u306b&#8221;\u5546\u54c1&#8221;\u8868\u3092\u691c\u7d22\u3092\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7d0d\u54c1\u660e\u7d30<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset; height: 131px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 20%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 20%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 20%; height: 24px;\">D01<\/td>\n<td style=\"width: 20%; height: 24px;\">1<\/td>\n<td style=\"width: 20%; height: 24px;\">S01<\/td>\n<td style=\"width: 20%; height: 24px;\">C01<\/td>\n<td style=\"width: 20%; height: 24px;\">10<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D02<\/td>\n<td style=\"width: 20%; height: 21px;\">1<\/td>\n<td style=\"width: 20%; height: 21px;\">S01<\/td>\n<td style=\"width: 20%; height: 21px;\">C22<\/td>\n<td style=\"width: 20%; height: 21px;\">30<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D02<\/td>\n<td style=\"width: 20%; height: 21px;\">2<\/td>\n<td style=\"width: 20%; height: 21px;\">S02<\/td>\n<td style=\"width: 20%; height: 21px;\">C22<\/td>\n<td style=\"width: 20%; height: 21px;\">20<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 20%; height: 21px;\">D03<\/td>\n<td style=\"width: 20%; height: 21px;\">1<\/td>\n<td style=\"width: 20%; height: 21px;\">S02<\/td>\n<td style=\"width: 20%; height: 21px;\">C03<\/td>\n<td style=\"width: 20%; height: 21px;\">40<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 20%; height: 20px;\">D03<\/td>\n<td style=\"width: 20%; height: 20px;\">2<\/td>\n<td style=\"width: 20%; height: 20px;\">S03<\/td>\n<td style=\"width: 20%; height: 20px;\">C03<\/td>\n<td style=\"width: 20%; height: 20px;\">60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u3053\u3067\u3082\u4e00\u3064\u305a\u3064\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u66f4\u65b0\u5bfe\u8c61\u306e\u5019\u88dc\u3068\u3057\u3066<span>&#8220;<\/span>\u7d0d\u54c1\u660e\u7d30<span>&#8220;<\/span>\u8868\u306e\uff11\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u53d6\u308a\u51fa\u3055\u308c\u305f\u3068\u3057\u307e\u3059\u3002\u7d0d\u54c1<span>ID&#8217;D01&#8242;<\/span>\u3067\u3059\u3002\u6b21\u306e<span>SELECT<\/span>\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT 1\r\n  FROM \u7d0d\u54c1\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = 'D01'\r\n<\/pre>\n<p>&#8220;\u7d0d\u54c1&#8221;\u8868\u306b\u7d0d\u54c1ID\u304c&#8217;D01&#8217;\u306e\u884c\u304c\uff11\u884c\u76ee\u306b\u3042\u308a\u3001\u691c\u7d22\u7d50\u679c\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306eEXISTS\u53e5\u306e\u7d50\u679c\u306f\u771f(TRUE)\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">EXISTS (\r\n  SELECT 1\r\n    FROM \u7d0d\u54c1\r\n   WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n)\r\n<\/pre>\n<p>\u3088\u3063\u3066\u3001&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306b\u7d0d\u54c1ID&#8217;D01&#8217;\u306f\u66f4\u65b0\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002\u7d9a\u3051\u3066\u3001\u300c\u5909\u66f4\u5185\u5bb9\u300d\u3092\u6c42\u3081\u308b\u305f\u3081\u3001\u6b21\u306eSELECT\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT \u9867\u5ba2ID\r\n  FROM \u7d0d\u54c1\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = 'D01'\r\n<\/pre>\n<p>&#8220;\u7d0d\u54c1\u201d\u8868\u306e\u7d0d\u54c1ID&#8217;D01&#8217;\u306e&#8221;\u9867\u5ba2ID&#8221;\u5217\u306e\u5024&#8217;C01&#8217;\u304c\u53d6\u5f97\u3055\u308c\u3001\u300cSET \u9867\u5ba2ID = &#8216;C01&#8217;\u300d\u3068\u306a\u308a\u307e\u3059\u3002\uff11\u884c\u76ee\u306e&#8221;\u9867\u5ba2ID&#8221;\u5217\u306e\u5024\u306f&#8217;C01&#8217;\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u66f4\u65b0\u5bfe\u8c61\u306e\u5019\u88dc\u3068\u3057\u3066&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306e\uff12\u884c\u76ee\u306e\u30ec\u30b3\u30fc\u30c9\u304c\u53d6\u308a\u51fa\u3055\u308c\u305f\u3068\u3057\u307e\u3059\u3002\u7d0d\u54c1ID&#8217;D02&#8217;\u3067\u3059\u3002\u6b21\u306eSELECT\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT 1\r\n  FROM \u7d0d\u54c1\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = 'D02'\r\n<\/pre>\n<p>&#8220;\u7d0d\u54c1&#8221;\u8868\u306b\u7d0d\u54c1ID\u304c&#8217;D02&#8217;\u306e\u884c\u304c\uff12\u884c\u76ee\u306b\u3042\u308a\u3001\u691c\u7d22\u7d50\u679c\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306eEXISTS\u53e5\u306e\u7d50\u679c\u306f\u771f(TRUE)\u3068\u306a\u308a\u307e\u3059<\/p>\n<pre class=\"prettyprint lang:default decode:true\">EXISTS (\r\n  SELECT 1\r\n    FROM \u7d0d\u54c1\r\n   WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n)\r\n<\/pre>\n<p>\u3088\u3063\u3066\u3001&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306b\u7d0d\u54c1ID&#8217;D02&#8217;\u306f\u66f4\u65b0\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002\u7d9a\u3051\u3066\u3001\u300c\u5909\u66f4\u5185\u5bb9\u300d\u3092\u6c42\u3081\u308b\u305f\u3081\u3001\u6b21\u306eSELECT\u6587\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">SELECT \u9867\u5ba2ID\r\n  FROM \u7d0d\u54c1\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = 'D02'\r\n<\/pre>\n<p>&#8220;\u7d0d\u54c1\u201d\u8868\u306e\u7d0d\u54c1ID&#8217;D02&#8217;\u306e&#8221;\u9867\u5ba2ID&#8221;\u5217\u306e\u5024&#8217;C22&#8217;\u304c\u53d6\u5f97\u3055\u308c\u3001\u300cSET \u9867\u5ba2ID = &#8216;C22&#8217;\u300d\u3068\u306a\u308a\u307e\u3059\u3002\uff12\u884c\u76ee\u306e&#8221;\u9867\u5ba2ID&#8221;\u5217\u306e\u5024\u306f&#8217;C22&#8217;\u306b\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\uff13\u884c\u76ee\u4ee5\u964d\u3082\u540c\u69d8\u306b\u300cWHERE \u6761\u4ef6\u5f0f\u300d\u304c\u8a55\u4fa1\u3055\u308c\u3001\u300c\u6761\u4ef6\u5f0f\u300d\u306e\u7d50\u679c\u304c\u771f(TRUE)\u3067\u3042\u308c\u3070\u3001\u300cSET \u5217\u540d = \u5909\u66f4\u5185\u5bb9\u300d\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u307e\u3067\u306fANSI\/ISO\u306eSQL\u306e\u898f\u683c\u306b\u57fa\u3065\u3044\u3066\u8aac\u660e\u3057\u3066\u304d\u307e\u3057\u305f\u3002\u7279\u5b9a\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u306b\u3088\u3089\u305a\u9069\u7528\u3067\u304d\u308b\u30b1\u30fc\u30b9\u304c\u591a\u3044\u306e\u3067\u3001\u307e\u305a\u306f\u57fa\u672c\u69cb\u6587\u901a\u308a\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u56fa\u6709\u306e\u69cb\u6587\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u554f\u984c\u306a\u3069\u3092\u89e3\u6c7a\u3067\u304d\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306f\uff14\u5927\u203b1\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u306b\u3064\u3044\u3066\u3001\u56fa\u6709\u306e\u69cb\u6587\u3092\u7d39\u4ecb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3><span id=\"-Oracle\">\uff14-\uff12\uff0eOracle\u306e\u5834\u5408<\/span><\/h3>\n<p>Oracle\u3067\u306f\u30a4\u30f3\u30e9\u30a4\u30f3\u30fb\u30d3\u30e5\u30fc\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE (\r\n         SELECT \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID AS \u65e7\u9867\u5ba2ID,\r\n                \u7d0d\u54c1.\u9867\u5ba2ID AS \u65b0\u9867\u5ba2ID\r\n           FROM \u7d0d\u54c1\u660e\u7d30, \u7d0d\u54c1\r\n          WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n       )\r\n   SET \u65e7\u9867\u5ba2ID = \u65b0\u9867\u5ba2ID;\r\n<\/pre>\n<p>\u4e00\u3064\u305a\u3064\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3068&#8221;\u7d0d\u54c1&#8221;\u8868\u304c\u300c\u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\u300d\u3068\u8a00\u3046\u6761\u4ef6\u3067\u5185\u90e8\u7d50\u5408\u3055\u308c\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"height: 155px; width: 100%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 77.6897%; height: 24px;\" colspan=\"5\">\u7d0d\u54c1\u660e\u7d30<\/td>\n<td style=\"width: 62.3103%; height: 24px;\" colspan=\"2\">\u7d0d\u54c1<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">D01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">C01<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">10<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">D01<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C02<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">30<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C02<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">20<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">40<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 14.7905%; height: 20px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 20px;\">S03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 20px;\">60<\/td>\n<td style=\"width: 11.4422%; height: 20px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID\u300d\u3068\u300c\u7d0d\u54c1.\u9867\u5ba2ID\u300d\u304c\u9078\u629e\u3055\u308c\u3066\u3001\u5217\u540d\u306b\u305d\u308c\u305e\u308c\u300c\u65e7\u9867\u5ba2ID\u300d\u3001\u300c\u65b0\u9867\u5ba2ID\u300d\u3068\u8a00\u3046\u5225\u540d\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u307e\u3059\u3002<\/p>\n<table style=\"width: 71.0079%; border-collapse: collapse; border-style: outset;\" height=\"216\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\">\u65e7\u9867\u5ba2ID<\/td>\n<td style=\"width: 50%;\">\u65b0\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">C01<\/td>\n<td style=\"width: 50%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">C02<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">C02<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 50%; height: 20px;\">C03<\/td>\n<td style=\"width: 50%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300cSET \u65e7\u9867\u5ba2ID = \u65b0\u9867\u5ba2ID\u300d\u304c\u9069\u7528\u3055\u308c\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"height: 194px; width: 70.5549%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\">\u65e7\u9867\u5ba2ID<\/td>\n<td style=\"width: 50%;\">\u65b0\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 50%; height: 24px;\">C01<\/td>\n<td style=\"width: 50%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<td style=\"width: 50%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<td style=\"width: 50%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 50%; height: 20px;\">C03<\/td>\n<td style=\"width: 50%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u308c\u306f\u3001\u5143\u306e&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3068&#8221;\u7d0d\u54c1&#8221;\u8868\u306b\u623b\u305b\u3070\u3001\u6b21\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 77.6897%; height: 24px;\" colspan=\"5\">\u7d0d\u54c1\u660e\u7d30<\/td>\n<td style=\"width: 62.3103%; height: 24px;\" colspan=\"2\">\u7d0d\u54c1<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">D01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">C01<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">10<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">D01<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C22<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">30<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C22<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">20<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">40<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 14.7905%; height: 20px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 20px;\">S03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 20px;\">60<\/td>\n<td style=\"width: 11.4422%; height: 20px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#8220;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3092\u898b\u308b\u3068\uff13\uff0d\uff11\u3068\u540c\u3058\u7d50\u679c\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u300cINNER JOIN\u300d\u3092\u4f7f\u3046\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u3082\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE (\r\n         SELECT \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID AS \u65e7\u9867\u5ba2ID,\r\n                \u7d0d\u54c1.\u9867\u5ba2ID AS \u65b0\u9867\u5ba2ID\r\n           FROM \u7d0d\u54c1\u660e\u7d30\r\n          INNER JOIN \u7d0d\u54c1\r\n             ON \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n       )\r\n   SET \u65e7\u9867\u5ba2ID = \u65b0\u9867\u5ba2ID;\r\n<\/pre>\n<h3><span id=\"-MySQL\">\uff14-\uff13\uff0eMySQL\u306e\u5834\u5408<\/span><\/h3>\n<p>MySQL\u3067\u306f\u7d50\u5408\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30, \u7d0d\u54c1\r\n   SET \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID = \u7d0d\u54c1.\u9867\u5ba2ID\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID;\r\n<\/pre>\n<p>\u4e00\u3064\u305a\u3064\u9806\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3068&#8221;\u7d0d\u54c1&#8221;\u8868\u304c\u300c\u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\u300d\u3068\u8a00\u3046\u6761\u4ef6\u3067\u5185\u90e8\u7d50\u5408\u3055\u308c\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 77.6897%; height: 24px;\" colspan=\"5\">\u7d0d\u54c1\u660e\u7d30<\/td>\n<td style=\"width: 62.3103%; height: 24px;\" colspan=\"2\">\u7d0d\u54c1<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">D01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">C01<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">10<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">D01<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C02<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">30<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C02<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">20<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">40<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 14.7905%; height: 20px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 20px;\">S03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 20px;\">60<\/td>\n<td style=\"width: 11.4422%; height: 20px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300cSET \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID = \u7d0d\u54c1.\u9867\u5ba2ID\u300d\u304c\u9069\u7528\u3055\u308c\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"width: 100%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 77.6897%; height: 24px;\" colspan=\"5\">\u7d0d\u54c1\u660e\u7d30<\/td>\n<td style=\"width: 62.3103%; height: 24px;\" colspan=\"2\">\u7d0d\u54c1<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">D01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">C01<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">10<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">D01<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C22<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">30<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C22<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">20<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">40<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 14.7905%; height: 20px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 20px;\">S03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 20px;\">60<\/td>\n<td style=\"width: 11.4422%; height: 20px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#8220;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3092\u898b\u308b\u3068\uff13\uff0d\uff11\u3068\u540c\u3058\u7d50\u679c\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u300cINNER JOIN\u300d\u3092\u4f7f\u3046\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u3082\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n INNER JOIN\u7d0d\u54c1\r\n    ON \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n   SET \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID = \u7d0d\u54c1.\u9867\u5ba2ID;\r\n<\/pre>\n<h3><span id=\"-SQL_Server\">\uff14-\uff14\uff0eSQL Server\u306e\u5834\u5408<\/span><\/h3>\n<p>SQL Server\u3067\u3082\u7d50\u5408\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID = \u7d0d\u54c1.\u9867\u5ba2ID\r\n  FROM \u7d0d\u54c1\u660e\u7d30, \u7d0d\u54c1\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID;\r\n<\/pre>\n<p>\u3000\u66f4\u65b0\u307e\u3067\u306e\u6d41\u308c\u306fMySQL\u3068\u540c\u69d8\u3067\u3059\u3002<\/p>\n<p>\u300cINNER JOIN\u300d\u3092\u4f7f\u3046\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u3082\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID = \u7d0d\u54c1.\u9867\u5ba2ID\r\n  FROM \u7d0d\u54c1\u660e\u7d30\r\n INNER JOIN \u7d0d\u54c1\r\n    ON \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID;\r\n<\/pre>\n<h3><span id=\"-PostgreSQL\">\uff14-\uff15\uff0ePostgreSQL\u306e\u5834\u5408<\/span><\/h3>\n<p>PostgreSQL\u3067\u3082\u7d50\u5408\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u7d0d\u54c1\u660e\u7d30.\u9867\u5ba2ID = \u7d0d\u54c1.\u9867\u5ba2ID\r\n  FROM \u7d0d\u54c1\r\n WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID;\r\n<\/pre>\n<p>\u66f4\u65b0\u307e\u3067\u306e\u6d41\u308c\u306fMySQL\u3068\u540c\u69d8\u3067\u3059\u3002<br \/>\nPostgreSQL\u3067\u306fSQL Server\u3068\u7570\u306a\u308a\u3001FROM\u53e5\u306b\u66f4\u65b0\u5bfe\u8c61\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u6307\u5b9a\u3057\u307e\u305b\u3093\u3002\u3053\u306e\u3088\u3046\u306a\u69cb\u6587\u3067\u3042\u308b\u305f\u3081\u3001\u66f4\u65b0\u5bfe\u8c61\u306e\u30c6\u30fc\u30d6\u30eb\u3068\u300cINNER JOIN\u300d\u3092\u4f7f\u3063\u3066\u66f8\u304f\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<h2><span id=\"i-7\">\uff15\uff0e\u4ed6\u306e\u8868\u3092\u53c2\u7167\u3059\u308b\u6642\u306b\u767a\u751f\u3057\u3084\u3059\u3044\u30a8\u30e9\u30fc<\/span><\/h2>\n<p>\uff13\uff0d\uff11\u3067\u306f\u3001\u300c\u5217\u540d = \u5909\u66f4\u5185\u5bb9\u300d\u306e\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306b\u526f\u554f\u3044\u5408\u308f\u305b\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001\u3053\u306e\u526f\u554f\u3044\u5408\u308f\u305b\u306e\u7d50\u679c\u304c\uff12\u30ec\u30b3\u30fc\u30c9\u4ee5\u4e0a\u3042\u308b\u3068\u3001\u3069\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u4ee3\u5165\u3059\u308b\u304b\u7279\u5b9a\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u3001\u3053\u306e\u30a8\u30e9\u30fc\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u6b21\u306e\u3088\u3046\u306aUPDATE\u6587\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">UPDATE \u7d0d\u54c1\u660e\u7d30\r\n   SET \u9867\u5ba2ID = (\r\n         SELECT \u9867\u5ba2ID\r\n           FROM \u7d0d\u54c1, \u7d0d\u54c1\u660e\u7d30\r\n          WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n       )\r\n WHERE EXISTS (\r\n         SELECT 1\r\n           FROM \u7d0d\u54c1\r\n          WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n       );\r\n<\/pre>\n<p>\u3053\u306eUPDATE\u6587\u306f\uff13\uff0d\uff11\u306eUPDATE\u6587\u3068\u3088\u304f\u4f3c\u3066\u3044\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\u3002\u300c\u5909\u66f4\u5185\u5bb9\u300d\u3092\u898b\u308b\u3068\u3001\uff13\uff0d\uff11\u3067\u306f<\/p>\n<pre class=\"prettyprint lang:default decode:true\">(\r\n  SELECT \u9867\u5ba2ID\r\n    FROM \u7d0d\u54c1\r\n   WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n)\r\n<\/pre>\n<p>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308b\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">(\r\n  SELECT \u9867\u5ba2ID\r\n    FROM \u7d0d\u54c1, \u7d0d\u54c1\u660e\u7d30\r\n   WHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\r\n)\r\n<\/pre>\n<p>\u4e00\u898b\u3059\u308b\u3068\u540c\u3058\u3088\u3046\u306b\u307f\u3048\u307e\u3059\u304c\u3001\u5b9f\u306f\u5168\u304f\u7570\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\uff13\uff0d\uff11\u3067\u300cWHERE \u7d0d\u54c1.\u7d0d\u54c1ID = \u7d0d\u54c1\u660e\u7d30.\u7d0d\u54c1ID\u300d\u306e&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u306fUPDATE\u6587\u3067\u66f4\u65b0\u3059\u308b\u8868\u3092\u6307\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308bUPDATE\u6587\u3067\u306f\u526f\u554f\u3044\u5408\u308f\u305b\u306eFROM\u53e5\u306b\u6307\u5b9a\u3055\u308c\u305f&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3092\u6307\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>\uff13\uff0d\uff11\u3067\u306f\u7d0d\u54c1ID&#8217;D01&#8217;\u3092\u66f4\u65b0\u3057\u3088\u3046\u3068\u3059\u308b\u6642\u306e\u526f\u554f\u3044\u5408\u308f\u305b\u306e\u7d50\u679c\u306f\u9867\u5ba2ID&#8217;C01&#8217;\u3060\u3051\u3067\u3059\u3002<\/p>\n<table style=\"width: 73.4693%; border-collapse: collapse; border-style: outset; height: 76px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"height: 30px; width: 11.8564%;\" colspan=\"5\">\u7d0d\u54c1\u660e\u7d30<\/td>\n<td style=\"width: 12.0596%;\" colspan=\"2\">\u7d0d\u54c1<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 11.8564%; height: 22px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 17.2764%; height: 22px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 16.8022%; height: 22px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 17.0054%; height: 22px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 9.48509%; height: 22px;\">\u7d0d\u54c1\u6570<\/td>\n<td style=\"width: 12.0596%; height: 22px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 15.2439%; height: 22px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 11.8564%; height: 24px;\">D01<\/td>\n<td style=\"width: 17.2764%; height: 24px;\">1<\/td>\n<td style=\"width: 16.8022%; height: 24px;\">S01<\/td>\n<td style=\"width: 17.0054%; height: 24px;\">C01<\/td>\n<td style=\"width: 9.48509%; height: 24px;\">10<\/td>\n<td style=\"width: 12.0596%; height: 24px;\">D01<\/td>\n<td style=\"width: 15.2439%; height: 24px;\">C01<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e00\u65b9\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308bUPDATE\u6587\u3067\u306f\u3001\u7d0d\u54c1ID&#8217;D01&#8217;\u3092\u66f4\u65b0\u3057\u3088\u3046\u3068\u3059\u308b\u6642\u3067\u3082\u3001FROM\u53e5\u306f\u3059\u3079\u3066\u306e&#8221;\u7d0d\u54c1\u660e\u7d30&#8221;\u8868\u3092\u8fd4\u3057\u307e\u3059\u306e\u3067\u3001\u526f\u554f\u3044\u5408\u308f\u305b\u306e\u7d50\u679c\u306f\u9867\u5ba2ID&#8217;C01&#8242;,&#8217;C22&#8242;,&#8217;C22&#8242;,&#8217;C03&#8242;,&#8217;C03&#8217;\u3067\u3059\u3002\u526f\u554f\u3044\u5408\u308f\u305b\u306e\u7d50\u679c\u306f\uff12\u30ec\u30b3\u30fc\u30c9\u4ee5\u4e0a\u3042\u308b\u3053\u3068\u306b\u306a\u308a\u3001\u30a8\u30e9\u30fc\u3068\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<table style=\"height: 167px; width: 100%; border-collapse: collapse; border-style: outset;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 77.6897%; height: 24px;\" colspan=\"5\">\u7d0d\u54c1\u660e\u7d30<\/td>\n<td style=\"width: 62.3103%; height: 24px;\" colspan=\"2\">\u7d0d\u54c1<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u660e\u7d30\u756a\u53f7<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">\u5546\u54c1ID<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">\u7d0d\u54c1\u6570<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">\u7d0d\u54c1ID<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">\u9867\u5ba2ID<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 14.7905%; height: 24px;\">D01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 24px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 24px;\">C01<\/td>\n<td style=\"width: 14.6773%; height: 24px;\">10<\/td>\n<td style=\"width: 11.4422%; height: 24px;\">D01<\/td>\n<td style=\"width: 50.8681%; height: 24px;\">C01<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S01<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C22<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">30<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C22<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">20<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D02<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C22<\/td>\n<\/tr>\n<tr style=\"height: 21px;\">\n<td style=\"width: 14.7905%; height: 21px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">1<\/td>\n<td style=\"width: 16.1495%; height: 21px;\">S02<\/td>\n<td style=\"width: 16.0362%; height: 21px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 21px;\">40<\/td>\n<td style=\"width: 11.4422%; height: 21px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 21px;\">C03<\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"width: 14.7905%; height: 20px;\">D03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">2<\/td>\n<td style=\"width: 16.1495%; height: 20px;\">S03<\/td>\n<td style=\"width: 16.0362%; height: 20px;\">C03<\/td>\n<td style=\"width: 14.6773%; height: 20px;\">60<\/td>\n<td style=\"width: 11.4422%; height: 20px;\">D03<\/td>\n<td style=\"width: 50.8681%; height: 20px;\">C03<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4eca\u56de\u306e\u4f8b\u3067\u306f\u3001\u300c\u5909\u66f4\u5185\u5bb9\u300d\u306e\u526f\u554f\u3044\u5408\u308f\u305b\u306eFROM\u53e5\u304b\u3089\u66f4\u65b0\u3059\u308b\u8868\u3092\u5916\u305b\u3070\u3001\u30a8\u30e9\u30fc\u306f\u767a\u751f\u3057\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u203b\uff11\u3000DB-Engines Ranking\uff08<span style=\"text-decoration: underline;\"><a href=\"https:\/\/db-engines.com\/en\/ranking\">https:\/\/db-engines.com\/en\/ranking<\/a><\/span>\uff09\u306e\uff11\uff5e\uff14\u4f4d\u306b\u57fa\u3065\u304f<\/p>\n<h2><span id=\"i-8\">\uff16\uff0e\u3055\u3044\u3054\u306b<\/span><\/h2>\n<p>SQL\u306eUPDATE\u6587\u306b\u3064\u3044\u3066\u3001\u57fa\u672c\u69cb\u6587\u306b\u5f93\u3063\u3066\u5f90\u3005\u306b\u8907\u96d1\u306a\u4e8b\u4f8b\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u53d6\u308a\u4e0a\u3052\u305f\u4e8b\u4f8b\u3067\u591a\u304f\u306e\u30b1\u30fc\u30b9\u304c\u30ab\u30d0\u30fc\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u306e\u7a2e\u985e\u306f\u591a\u6570\u3042\u308a\u3001\u305d\u308c\u305e\u308c\u65b9\u8a00\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u57fa\u672c\u69cb\u6587\u3067\u5b9f\u73fe\u3067\u304d\u308b\u7bc4\u56f2\u306f\u304b\u306a\u308a\u5e83\u3044\u306e\u3067\u3001\u307e\u305a\u306f\u57fa\u672c\u69cb\u6587\u306b\u57fa\u3065\u3044\u3066\u30a2\u30d7\u30ed\u30fc\u30c1\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<br \/>\n\u57fa\u672c\u3067\u4f55\u304b\u8ab2\u984c\u304c\u3042\u3063\u305f\u5834\u5408\u306b\u3001\u305d\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7ba1\u7406\u30b7\u30b9\u30c6\u30e0\u56fa\u6709\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u3092\u691c\u8a0e\u3059\u308b\u3068\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7686\u69d8\u306e\u8ab2\u984c\u306e\u89e3\u6c7a\u306b\u304a\u5f79\u306b\u7acb\u3066\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL\u306b\u304a\u3051\u308b\u30c7\u30fc\u30bf\u64cd\u4f5c\u8a00\u8a9e (DML)\u306e1\u3064\u3067\u3001\u30c6\u30fc\u30d6\u30eb\u5185\u306e\u30c7\u30fc\u30bf\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b\u3068\u304d\u306b\u4f7f\u3046\u547d\u4ee4\u304cUPDATE\u6587\u3067\u3059\u3002 UPDATE\u6587\u306e\u57fa\u672c\u306b\u7acb\u3061\u8fd4\u308a\u3001\u8a08\u7b97\u5f0f\u3001case\u5f0f\u3001\u8907\u6570\u30c6\u30fc\u30d6\u30eb\u306e\u53d6\u308a\u6271\u3044\u306b\u3064\u3044\u3066\u3001\u8aac\u660e\u3057\u3066\u884c\u304d\u307e\u3057 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":4439,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,11],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/5910"}],"collection":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/comments?post=5910"}],"version-history":[{"count":11,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/5910\/revisions"}],"predecessor-version":[{"id":6137,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/5910\/revisions\/6137"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media\/4439"}],"wp:attachment":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media?parent=5910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/categories?post=5910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}