<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>todays_mitsui</author_name>
  <author_url>https://blog.hatena.ne.jp/todays_mitsui/</author_url>
  <blog_title>無駄と文化</blog_title>
  <blog_url>https://blog.mudatobunka.org/</blog_url>
  <categories>
    <anon>Database</anon>
    <anon>MySQL</anon>
  </categories>
  <description>DB にレコードを INSERT するとき、一手間加えて 未登録の場合に限って登録 や 登録済みなら一部フィールドだけ上書き などしたくなりますよね。 ここ最近、そのような SQL を書くことが多かったのでメモしておきます。 ちなみに MySQL の独自構文などもバリバリ使っているので、他のベンダーの DB に適用するときは部分的な書き換えが必要かもしれません。 レコードが存在していなかったら新規登録、存在していれば上書き INSERT INTO `posts`( `id` ,`title` ,`body` ,`created_at` ,`updated_at` ) VALUES ( 42 ,…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.mudatobunka.org%2Fentry%2F2017%2F01%2F30%2F011621&quot; title=&quot;一手間加えた INSERT - レコードが未登録のとき、登録済みのとき、 - 無駄と文化&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-01-30 01:16:21</published>
  <title>一手間加えた INSERT - レコードが未登録のとき、登録済みのとき、</title>
  <type>rich</type>
  <url>https://blog.mudatobunka.org/entry/2017/01/30/011621</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
