<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: The difference between a unique index and primary key in MySQL</title>
	<atom:link href="http://www.xaprb.com/blog/2009/09/12/the-difference-between-a-unique-index-and-primary-key-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2009/09/12/the-difference-between-a-unique-index-and-primary-key-in-mysql/</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 20:41:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Pankaj</title>
		<link>http://www.xaprb.com/blog/2009/09/12/the-difference-between-a-unique-index-and-primary-key-in-mysql/#comment-19387</link>
		<dc:creator>Pankaj</dc:creator>
		<pubDate>Tue, 24 May 2011 07:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1276#comment-19387</guid>
		<description>what will happen if I will give only KEY while creating the table, in that case there won&#039;t be any primary key?</description>
		<content:encoded><![CDATA[<p>what will happen if I will give only KEY while creating the table, in that case there won&#8217;t be any primary key?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Wultsch</title>
		<link>http://www.xaprb.com/blog/2009/09/12/the-difference-between-a-unique-index-and-primary-key-in-mysql/#comment-16966</link>
		<dc:creator>Rob Wultsch</dc:creator>
		<pubDate>Sun, 13 Sep 2009 07:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1276#comment-16966</guid>
		<description>I (unfortunately) have used 3.23 quite a bit. A primary key was UNIQUE NOT NULL back then as it is now. I think in early version that might not have been the case.

Given that null does not describe a value so much as an unknown value:
mysql&gt; select &#039;Null equals Null&#039; from dual where null=null;
Empty set (0.00 sec)

mysql&gt; select &#039;Null does not equals Null&#039; from dual where null!=null;
Empty set (0.00 sec)

I don&#039;t have a problem with how unique is used in RDMS, but then again I am in the pro-null camp. Perhaps I should seek psychiatric evaluation?</description>
		<content:encoded><![CDATA[<p>I (unfortunately) have used 3.23 quite a bit. A primary key was UNIQUE NOT NULL back then as it is now. I think in early version that might not have been the case.</p>
<p>Given that null does not describe a value so much as an unknown value:<br />
mysql&gt; select &#8216;Null equals Null&#8217; from dual where null=null;<br />
Empty set (0.00 sec)</p>
<p>mysql&gt; select &#8216;Null does not equals Null&#8217; from dual where null!=null;<br />
Empty set (0.00 sec)</p>
<p>I don&#8217;t have a problem with how unique is used in RDMS, but then again I am in the pro-null camp. Perhaps I should seek psychiatric evaluation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Bouman</title>
		<link>http://www.xaprb.com/blog/2009/09/12/the-difference-between-a-unique-index-and-primary-key-in-mysql/#comment-16963</link>
		<dc:creator>Roland Bouman</dc:creator>
		<pubDate>Sat, 12 Sep 2009 22:52:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=1276#comment-16963</guid>
		<description>Hi!

It&#039;s worth pointing out that although it seems counterintuitive, this conforms to the SQL standard. It works exactly like this in Oracle.

I am not sure about the 3.23 behaviour, but as long as i have been using MySQL, it allows DDL like this:

CREATE TABLE T (a int, b int, primary key(a,b))

Now the strange thing is that a and b appear nullable, but when you do a SHOW CREATE TABLE T, they turn out to be not nullable - this is automatic smarts that one may or may not like (it actually occurs even if you explcitly declare the columns as NULL)

kind regards,

Roland</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>It&#8217;s worth pointing out that although it seems counterintuitive, this conforms to the SQL standard. It works exactly like this in Oracle.</p>
<p>I am not sure about the 3.23 behaviour, but as long as i have been using MySQL, it allows DDL like this:</p>
<p>CREATE TABLE T (a int, b int, primary key(a,b))</p>
<p>Now the strange thing is that a and b appear nullable, but when you do a SHOW CREATE TABLE T, they turn out to be not nullable &#8211; this is automatic smarts that one may or may not like (it actually occurs even if you explcitly declare the columns as NULL)</p>
<p>kind regards,</p>
<p>Roland</p>
]]></content:encoded>
	</item>
</channel>
</rss>

