{"id":109936,"date":"2024-03-22T16:21:34","date_gmt":"2024-03-22T07:21:34","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/"},"modified":"2024-03-28T12:49:09","modified_gmt":"2024-03-28T03:49:09","slug":"mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/","title":{"rendered":"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5"},"content":{"rendered":"<p>MySQL\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>UPDATE\u6587\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\uff1aUPDATE\u6587\u3092\u4f7f\u3046\u3068\u3001\u8868\u5185\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3067\u304d\u307e\u3059\u3002\u69cb\u6587\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/li>\n<li>\u30c6\u30fc\u30d6\u30eb\u540d UPDATE SET \u30ab\u30e9\u30e0\u540d1=\u50241\u3001\u30ab\u30e9\u30e0\u540d2=\u50242\u3001 &#8230; WHERE \u6761\u4ef6;<\/li>\n<li>\u4f8b\u3048\u3070\uff1a<\/li>\n<li>UPDATE students SET age = 20, name = &#8216;John&#8217; WHERE id = 1;<\/li>\n<li>INSERT INTO \u2026 ON DUPLICATE KEY UPDATE\u6587\u306f\u3001\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u3068\u304d\u306b\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u3092\u633f\u5165\u3067\u304d\u307e\u3059\u3002\u69cb\u6587\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/li>\n<li>INSERT INTO \u30c6\u30fc\u30d6\u30eb\u540d (\u5217\u540d1, \u5217\u540d2, &#8230;) VALUES (\u50241, \u50242, &#8230;) ON DUPLICATE KEY UPDATE \u5217\u540d1 = \u50241, \u5217\u540d2 = \u50242, &#8230;<\/li>\n<li>\u4f8b\uff1aThe cat sat on the mat. -&gt; \u732b\u304c\u3054\u3056\u306e\u4e0a\u306b\u5ea7\u308b\u3002<\/li>\n<li>\u91cd\u8907\u30ad\u30fc\u304c\u3042\u308c\u3070name\u3092&#8217;John&#8217;\u3001age\u309220\u306b\u66f4\u65b0\u3001\u306a\u3051\u308c\u3070id\u30921\u3001name\u3092&#8217;John&#8217;\u3001age\u309220\u3068\u3057\u3066\u3001students\u30c6\u30fc\u30d6\u30eb\u306b\u633f\u5165<\/li>\n<li>REPLACE\u6587\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff1aREPLACE\u6587\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u540c\u3058\u30e6\u30cb\u30fc\u30af\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u30c6\u30fc\u30d6\u30eb\u5185\u306b\u3042\u308b\u5834\u5408\u306f\u65e2\u5b58\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3057\u3066\u65b0\u898f\u306e\u30c7\u30fc\u30bf\u3092\u633f\u5165\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u69cb\u6587\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/li>\n<li>REPLACE INTO \u30c6\u30fc\u30d6\u30eb\u540d (\u30ab\u30e9\u30e0\u540d1, \u30ab\u30e9\u30e0\u540d2, &#8230;) VALUES (\u50241, \u50242, &#8230;);<\/li>\n<li>\u4f8b\u3048\u3070<\/li>\n<li>REPLACE INTO students (id, name, age) VALUES (1, &#8216;John&#8217;, 20);<\/li>\n<li>INSERT INTO &#8230; SELECT &#8230; ON DUPLICATE KEY UPDATE\u6587\u3092\u4f7f\u7528\u3057\u305f\u4e00\u62ec\u66f4\u65b0<\/li>\n<li>INSERT INTO \u30c6\u30fc\u30d6\u30eb\u540d (\u30ab\u30e9\u30e0\u540d1, \u30ab\u30e9\u30e0\u540d2, &#8230;) SELECT \u50241, \u50242, &#8230; FROM \u30c6\u30fc\u30d6\u30eb\u540d2 ON DUPLICATE KEY UPDATE \u30ab\u30e9\u30e0\u540d1=\u50241, \u30ab\u30e9\u30e0\u540d2=\u50242, &#8230;;<\/li>\n<li>\u4f8b\uff1a<\/li>\n<li>INSERT INTO students (id, name, age) SELECT id, name, age FROM other_students ON DUPLICATE KEY UPDATE name= VALUES(name), age=VALUES(age);<\/li>\n<\/ol>\n<p>\u4e0a\u8a18\u306e\u65b9\u6cd5\u306fMySQL\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u4e00\u822c\u7684\u306a\u65b9\u6cd5\u3067\u3042\u308a\u3001\u30cb\u30fc\u30ba\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u65b9\u6cd5\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff1a UPDATE\u6587\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\uff1aUPDATE\u6587\u3092\u4f7f\u3046\u3068\u3001\u8868\u5185\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3067\u304d\u307e\u3059\u3002\u69cb\u6587\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002 \u30c6\u30fc\u30d6\u30eb\u540d UPDATE SET \u30ab\u30e9\u30e0\u540d1=\u50241\u3001\u30ab\u30e9\u30e0\u540d2=\u50242\u3001 &#038; [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-109936","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MySQL \u306e\u66f4\u65b0\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-\u306e\u66f4\u65b0\u65b9\u6cd5\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"MySQL\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff1a UPDATE\u6587\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\uff1aUPDATE\u6587\u3092\u4f7f\u3046\u3068\u3001\u8868\u5185\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3067\u304d\u307e\u3059\u3002\u69cb\u6587\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002 \u30c6\u30fc\u30d6\u30eb\u540d UPDATE SET \u30ab\u30e9\u30e0\u540d1=\u50241\u3001\u30ab\u30e9\u30e0\u540d2=\u50242\u3001 &amp; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-\u306e\u66f4\u65b0\u65b9\u6cd5\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-22T07:21:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-28T03:49:09+00:00\" \/>\n<meta name=\"author\" content=\"\u5149, \u660e\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u5149, \u660e\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/\",\"name\":\"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2024-03-22T07:21:34+00:00\",\"dateModified\":\"2024-03-28T03:49:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/9ee62cea876d247deba14a0ac7ba5b55\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/9ee62cea876d247deba14a0ac7ba5b55\",\"name\":\"\u5149, \u660e\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g\",\"caption\":\"\u5149, \u660e\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/hikariakira\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-\u306e\u66f4\u65b0\u65b9\u6cd5\/","og_locale":"ja_JP","og_type":"article","og_title":"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5","og_description":"MySQL\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\u65b9\u6cd5\uff1a UPDATE\u6587\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3059\u308b\uff1aUPDATE\u6587\u3092\u4f7f\u3046\u3068\u3001\u8868\u5185\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3067\u304d\u307e\u3059\u3002\u69cb\u6587\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002 \u30c6\u30fc\u30d6\u30eb\u540d UPDATE SET \u30ab\u30e9\u30e0\u540d1=\u50241\u3001\u30ab\u30e9\u30e0\u540d2=\u50242\u3001 & [&hellip;]","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-\u306e\u66f4\u65b0\u65b9\u6cd5\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-03-22T07:21:34+00:00","article_modified_time":"2024-03-28T03:49:09+00:00","author":"\u5149, \u660e","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u5149, \u660e"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/","name":"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2024-03-22T07:21:34+00:00","dateModified":"2024-03-28T03:49:09+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/9ee62cea876d247deba14a0ac7ba5b55"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"MySQL \u306e\u66f4\u65b0\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/9ee62cea876d247deba14a0ac7ba5b55","name":"\u5149, \u660e","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g","caption":"\u5149, \u660e"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/hikariakira\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/mysql-%e3%81%ae%e6%9b%b4%e6%96%b0%e6%96%b9%e6%b3%95\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/109936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=109936"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/109936\/revisions"}],"predecessor-version":[{"id":205529,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/109936\/revisions\/205529"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=109936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=109936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=109936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}