<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Labs Zsrv Net &#187; MySQL</title>
	<atom:link href="http://labs.zsrv.net/category/develop/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.zsrv.net</link>
	<description>About Gadget, iPhone, Android and so on.</description>
	<lastBuildDate>Fri, 18 Feb 2011 09:34:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>[MySQL]Primary Key IS NONEでSELECTした場合の挙動について</title>
		<link>http://labs.zsrv.net/2009/11/mysqlprimary-key-is-none%e3%81%a7select%e3%81%97%e3%81%9f%e5%a0%b4%e5%90%88%e3%81%ae%e6%8c%99%e5%8b%95%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/</link>
		<comments>http://labs.zsrv.net/2009/11/mysqlprimary-key-is-none%e3%81%a7select%e3%81%97%e3%81%9f%e5%a0%b4%e5%90%88%e3%81%ae%e6%8c%99%e5%8b%95%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 01:59:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://labs.zsrv.net/?p=336</guid>
		<description><![CDATA[はまったので、メモっておく。 同一セッション内で、INSERTしたあとにPK IS NULLでSELECTすると、最後にINSERTした値が返ってくる。 mysql&#62; CREATE TABLE test_test(id int(11) NOT NULL auto_increment, name varchar(50), PRIMARY KEY (id)); Query OK, 0 rows affected (0.01 sec) mysql&#62; INSERT INTO test_test(name) VALUES('hogehoge'); Query OK, 1 row affected (0.00 sec) mysql&#62; SELECT * FROM test_test WHERE id IS NULL; +----+----------+ &#124; id &#124; name &#124; +----+----------+ &#124; 1 &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>はまったので、メモっておく。<br />
同一セッション内で、INSERTしたあとにPK IS NULLでSELECTすると、最後にINSERTした値が返ってくる。</p>
<pre class="brush:sql">mysql&gt; CREATE TABLE test_test(id int(11) NOT NULL auto_increment, name varchar(50), PRIMARY KEY (id));
Query OK, 0 rows affected (0.01 sec)

mysql&gt; INSERT INTO test_test(name) VALUES('hogehoge');
Query OK, 1 row affected (0.00 sec)

mysql&gt; SELECT * FROM test_test WHERE id IS NULL;
+----+----------+
| id | name     |
+----+----------+
|  1 | hogehoge |
+----+----------+
1 row in set (0.00 sec)</pre>
<p>ちなみに以下を発行すると、上記機能は無効になる。</p>
<pre class="brush:sql">set sql_auto_is_null = 0;</pre>
<p><a href="http://www.mail-archive.com/django-users@googlegroups.com/msg74245.html">参考URL</a></p>
<img src="http://labs.zsrv.net/?ak_action=api_record_view&id=336&type=feed" alt="" /><p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Digg" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_button_google_bookmarks" href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/google.png" width="16" height="16" alt="Google Bookmarks"/></a> <a class="a2a_button_google_reader" href="http://www.addtoany.com/add_to/google_reader?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Google Reader" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/reader.png" width="16" height="16" alt="Google Reader"/></a> <a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Facebook" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Delicious" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a class="a2a_button_friendfeed" href="http://www.addtoany.com/add_to/friendfeed?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="FriendFeed" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/friendfeed.png" width="16" height="16" alt="FriendFeed"/></a> <a class="a2a_button_evernote" href="http://www.addtoany.com/add_to/evernote?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Evernote" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/evernote.png" width="16" height="16" alt="Evernote"/></a> <a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Flabs.zsrv.net%2F2009%2F11%2Fmysqlprimary-key-is-none%25e3%2581%25a7select%25e3%2581%2597%25e3%2581%259f%25e5%25a0%25b4%25e5%2590%2588%25e3%2581%25ae%25e6%258c%2599%25e5%258b%2595%25e3%2581%25ab%25e3%2581%25a4%25e3%2581%2584%25e3%2581%25a6%2F&amp;linkname=%5BMySQL%5DPrimary%20Key%20IS%20NONE%E3%81%A7SELECT%E3%81%97%E3%81%9F%E5%A0%B4%E5%90%88%E3%81%AE%E6%8C%99%E5%8B%95%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6" title="Twitter" rel="nofollow" target="_blank"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://labs.zsrv.net/wp-content/plugins/add-to-any/favicon.png" width="16" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://labs.zsrv.net/2009/11/mysqlprimary-key-is-none%e3%81%a7select%e3%81%97%e3%81%9f%e5%a0%b4%e5%90%88%e3%81%ae%e6%8c%99%e5%8b%95%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

