<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://cafe.jenkster.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Cafe de Jenkster - Dumb, Dumber and Dumbest - 3 Stupid Database Things - Comments</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas</link>
 <description>Comments for &quot;Dumb, Dumber and Dumbest - 3 Stupid Database Things&quot;</description>
 <language>en</language>
<item>
 <title>Sorry Dave, but you&#039;re</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-6895</link>
 <description>&lt;p&gt;Sorry Dave, but you&#039;re wrong.  &#039;0&#039; isn&#039;t a rank, it&#039;s an arbitrary magic value.  Having a magic value to mean &quot;no rank&quot; is just a workaround.  Perfectly practical, but not perfectly correct.&lt;/p&gt;

&lt;p&gt;The empty string can be represented several ways.  Two that spring to mind are:&lt;/p&gt;


&lt;ol&gt;
&lt;li&gt;All strings end in the null terminator &#039;\0&#039;.  The empty string consists of just this terminator.&lt;/li&gt;
&lt;li&gt;All strings are stored with a pointer to the start of the content, and a length.  The empty string has length == 0.&lt;/li&gt;
&lt;/ol&gt;



&lt;p&gt;If memory serves, the first approach is used in C, the second in Pro*C.  So, yes, Postgres probably does do it the way you suggest.&lt;/p&gt;

&lt;p&gt;And you&#039;re right, &lt;span class=&quot;caps&quot;&gt;SQLS&lt;/span&gt;erver&#039;s nuts. &lt;img src=&quot;/sites/all/modules/smileys/packs/jenkster/smile.gif&quot; title=&quot;[smile]&quot; alt=&quot;[smile]&quot; /&gt;&lt;/p&gt;</description>
 <pubDate>Thu, 24 May 2007 18:22:00 +0100</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 6895 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>So Oracle RANK NOT NULL</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-6892</link>
 <description>&lt;p&gt;So Oracle &lt;span class=&quot;caps&quot;&gt;RANK NOT NULL DEFAULT &lt;/span&gt;&#039;0&#039; --this covers you as a civilian  :)&lt;/p&gt;

&lt;p&gt;Postgres what&#039;s in the &lt;span class=&quot;caps&quot;&gt;NOT NULL &lt;/span&gt;rank field for empty string &#039;&#039; an unprintable char ascii 0?&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;SQLS&lt;/span&gt;erver that&#039;s just ridiculous not forcing elimination of non-unique rows first....&lt;/p&gt;</description>
 <pubDate>Thu, 24 May 2007 15:04:57 +0100</pubDate>
 <dc:creator>Dave</dc:creator>
 <guid isPermaLink="false">comment 6892 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>To be honest, I just wanted</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-3861</link>
 <description>&lt;p&gt;To be honest, I just wanted to show you how to meet this specific requirement. I think that in most cases, you can get away using nullable columns. &lt;br /&gt;
Most of these ambiguity problems can be solved by sticking to a convention. Any convention will do, as long as everybody on your team agrees on using the same convention. Make sure you include conventions in your documentation and everybody will be all right.&lt;/p&gt;

&lt;p&gt;Oracle&#039;s behavior is documented, so developers know what to expect. You are correct that this behavior differs from the &lt;span class=&quot;caps&quot;&gt;ANSI &lt;/span&gt;standard - conflicting conventions, which is where the discussion got started.&lt;br /&gt;
Personally, I think that Oracle&#039;s implementation requires me to write less code to maintain data integrity. With less code, there&#039;s less chance for bugs creeping in.&lt;/p&gt;

&lt;p&gt;In the end, it all depends on the requirements.&lt;/p&gt;</description>
 <pubDate>Wed, 20 Dec 2006 10:30:05 +0000</pubDate>
 <dc:creator>Mel</dc:creator>
 <guid isPermaLink="false">comment 3861 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>That&#039;s an interesting</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-3856</link>
 <description>&lt;p&gt;That&#039;s an interesting approach Mel, but I&#039;m not sure how far you&#039;d take it.  Would you do away will all &lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;able columns?  Or if not, when would you allow them, and what would they mean?&lt;/p&gt;</description>
 <pubDate>Wed, 20 Dec 2006 08:59:49 +0000</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 3856 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>Actually, I think your table</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-3849</link>
 <description>&lt;p&gt;Actually, I think your table design was flawed. You insisted in storing a rank with a &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;value, which means that the rank is unknown.&lt;/p&gt;

&lt;p&gt;If you would be able to store a zero length string, than that would be &#039;the rank without a name&#039;... Which seems like a rank to me &lt;img src=&quot;/sites/all/modules/smileys/packs/jenkster/wink.gif&quot; title=&quot;[wink]&quot; alt=&quot;[wink]&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If you really want to satisfy the requirement, you would need two tables - one for &lt;span class=&quot;caps&quot;&gt;PERSON &lt;/span&gt;and another for &lt;span class=&quot;caps&quot;&gt;RANK, &lt;/span&gt;(related to &lt;span class=&quot;caps&quot;&gt;PERSON&lt;/span&gt;): The fact that you don&#039;t have a rank, should be deduced from the &lt;strong&gt;absence&lt;/strong&gt; of a row in the ranks table.&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;</description>
 <pubDate>Tue, 19 Dec 2006 22:55:56 +0000</pubDate>
 <dc:creator>Mel</dc:creator>
 <guid isPermaLink="false">comment 3849 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>I thought of the</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-2919</link>
 <description>&lt;p&gt;I thought of the SHEEP_IN_THE_FIELD table when considering the statement &quot;There are now 0 characters in the string. It&#039;s not NULL; nothing magical has happened; nothing has gone into an unknown state. There are zero characters.&quot; -- specifically I wondered what would happen if the string had to be stored character-by-character in a separate table.  &lt;/p&gt;
&lt;p&gt;Would one ever store a NULL sheep row in the table?&lt;/p&gt;
&lt;p&gt;I&#039;m not sure how you concluded that &quot;Oracle got it wrong&quot; from the statement that &quot;Mathematics is one area of study where we can still say, &#039;This is absolutely correct. And that is demonstrably wrong.&#039;&quot;.  Mathematics can make a number of definition statements.  Neither Euclidean nor non-Euclidean geometry is wrong, but they have different starting assumptions/definitions and areas of modeling applicability.&lt;/p&gt;
&lt;p&gt;Similarly, I&#039;m not convinced that &quot;Oracle got it wrong&quot;, rather they defined things a bit differently than the ANSI committee.  Is this really a violation of 3-value logic or just a convention?  Having worked with Oracle for 8 years now, having a zero-length string being automatically called NULL seems reasonable, and having to test for the condition of either zero-length strings Or NULLs (as I did recently for a DB2 query) irksome.  I really don&#039;t know which came first: Oracle&#039;s implementation or the ANSI standard.&lt;/p&gt;
</description>
 <pubDate>Thu, 03 Aug 2006 14:12:43 +0100</pubDate>
 <dc:creator>Duke Ganote</dc:creator>
 <guid isPermaLink="false">comment 2919 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>Interesting question. </title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-2917</link>
 <description>&lt;p&gt;Interesting question.  Assuming the database is kept up-to-date, then the empty table would be 0 sheep.  If the table hasn&#039;t been created, then the number of sheep is unknown by the system, and hence NULL.  And if you haven&#039;t bothered to keep the database up-to-date, then that&#039;s a whole different issue.&lt;/p&gt;
&lt;p&gt;As for the DBMS quirks argument, I don&#039;t really buy it.  It&#039;s great to have tolerance and understanding in the fields of religion, music and art, and even in software &lt;em&gt;design&lt;/em&gt;, but the rules of tri-state logic are as defined and rigorous as the rules of addition and multiplication.  You can bend them for preference.  Mathematics is one area of study where we can still say, &quot;This is absolutely correct.  And that is demonstrably wrong.&quot;&lt;/p&gt;
&lt;p&gt;Oracle got it wrong.  I can deal with that.  I deal with it every day and it very rarely bothers me.  And I&#039;m not proposing we change it because it would be impractical.  But that doesn&#039;t make Oracle quirky or characterful.  It remains logically incorrect.&lt;/p&gt;
</description>
 <pubDate>Thu, 03 Aug 2006 09:45:12 +0100</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 2917 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>Suppose instead of counting</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-2916</link>
 <description>&lt;p&gt;Suppose instead of counting sheep, you store a row for every sheep in a SHEEP_IN_THE_FIELD table.  You start out with 1 row/sheep.  Take that sheep away.  There are now no sheep in the field, and the SHEEP_IN_THE_FIELD table has no rows:  is that a count of ZERO or NULL?  &lt;/p&gt;
&lt;p&gt;Also, do no records in SHEEP_IN_THE_FIELD mean you haven&#039;t bothered to count any sheep yet, or there are none?&lt;/p&gt;
&lt;p&gt;And regarding DBMS quirks -- if the rules are known, then they can be dealt with.  It&#039;s when you don&#039;t know them, assume it&#039;s behavior you are familiar with, that you get that fabulous school-o-hard-knocks experience.&lt;/p&gt;
</description>
 <pubDate>Wed, 02 Aug 2006 21:27:37 +0100</pubDate>
 <dc:creator>Duke Ganote</dc:creator>
 <guid isPermaLink="false">comment 2916 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1816</link>
 <description>&lt;p&gt;Frank, I completely agree with you.&lt;/p&gt;
</description>
 <pubDate>Wed, 22 Feb 2006 14:14:54 +0000</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 1816 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1817</link>
 <description>&lt;p&gt;Kris, NULL is NOT NOTHING, it is unknown.&lt;br /&gt;
That&#039;s why NULL != NULL, and: if NULL=NULL evaluates to NULL (in Oracle, that is), and not to TRUE.&lt;/p&gt;
&lt;p&gt;As for your field: the number of hedgehogs is NULL.&lt;br /&gt;
Because I cannot see your field, I cannot positively state the number of hedgehogs (frogs, people, horses) is 0. That would require knowledge. NULL is unknown, &quot;don&#039;t know&quot;, &quot;no knowledge of it&quot;.&lt;/p&gt;
&lt;p&gt;And Oracle does flaw the ANSI standards with regard to empty strings being evaluated as NULL, indeed.&lt;br /&gt;
Guess it breaks too much fixing it. That means you will have to redesign your implementation of the business model, due to restrictions in the engine. Done at more than one occasion (know any database that supports M:M relations?).&lt;/p&gt;
</description>
 <pubDate>Wed, 22 Feb 2006 14:03:44 +0000</pubDate>
 <dc:creator>Frank</dc:creator>
 <guid isPermaLink="false">comment 1817 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1815</link>
 <description>&lt;p&gt;Take a field with 1 sheep in it.  There is 1 sheep in the field.  Take that sheep away.  There are now 0 sheep in the field.  It&#039;s not NULL; nothing magical has happened; nothing has gone into an unknown state.  There are zero sheep.&lt;/p&gt;
&lt;p&gt;Take a string with 1 character in it.  There is 1 character in the string.  Take that character away.  There are now 0 characters in the string.  It&#039;s not NULL; nothing magical has happened; nothing has gone into an unknown state.  There are zero characters.&lt;/p&gt;
</description>
 <pubDate>Mon, 30 Jan 2006 15:49:42 +0000</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 1815 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1814</link>
 <description>&lt;p&gt;&quot;&quot; is an *empty* string and so contains nothing.&lt;br /&gt;
NULL is nothing&lt;br /&gt;
so &quot;&quot; = NULL.&lt;/p&gt;
&lt;p&gt;You guys are attaching too many symantics to NULL.  I don&#039;t really think it means &quot;I don&#039;t know&quot;.  I think it means there is NOTHING THERE.&lt;/p&gt;
&lt;p&gt;Need to store &quot;CIVILIAN&quot; in your military PERSON database table?  Redesign it.  Sheesh.&lt;/p&gt;
</description>
 <pubDate>Mon, 30 Jan 2006 15:40:08 +0000</pubDate>
 <dc:creator>Nakedcity</dc:creator>
 <guid isPermaLink="false">comment 1814 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1813</link>
 <description>&lt;blockquote&gt;&lt;p&gt;First of all, I agree with sPh on the Oracle. Your rank is known, and its CIVILIAN (or something).&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Sorry Robert, but I can&#039;t agree.  CIVILIAN isn&#039;t a rank.  You can&#039;t get promoted or demoted to the rank of CIVILIAN.  No-one in the history of the military has been a CIVILIAN.  You&#039;re using a magic value to work around the Oracle problem.  And it&#039;s a good workaround when you&#039;re using an Oracle database, but it&#039;s not really modelling reality.&lt;/p&gt;
&lt;p&gt;Don&#039;t get me wrong - I&#039;d do exactly what you&#039;re suggesting.  And I think Oracle&#039;s a great database.  But it fluffs it up at this one point and it&#039;s always irked me.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Furthermore, if your rank is legitimately NULL, well then your data model is wrong if you don&#039;t allow for that, right?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Nope.  If you accept that NULL means, &quot;unknown&quot;, then my rank is not legitimately unknown.  As I said in the post, it&#039;s perfectly well known.  It&#039;s empty.  No-thing is &lt;em&gt;not&lt;/em&gt; the same as unknown-thing.&lt;/p&gt;
&lt;p&gt;Put it this way: &quot;&quot; is the string equivalent of 0.&lt;/p&gt;
&lt;p&gt;How many times have you and I met face-to-face?  It&#039;s not unknown, it&#039;s 0.&lt;br /&gt;
And what have we said during those meetings?  It&#039;s not unknown, it&#039;s &quot;&quot;.&lt;/p&gt;
</description>
 <pubDate>Sun, 29 Jan 2006 20:41:57 +0000</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 1813 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1812</link>
 <description>&lt;p&gt;First of all, I agree with sPh on the Oracle.  Your rank is known, and its CIVILIAN (or something).&lt;/p&gt;
&lt;p&gt;Furthermore, if your rank is legitimately NULL, well then your data model is wrong if you don&#039;t allow for that, right?&lt;/p&gt;
&lt;p&gt;You didn&#039;t mention the MS SQL/Sybase blend.  I love the way they have a configuration variable &quot;ansinull&quot; so you can actually decide to make your database non-ANSI-Compliant with regards to NULL.&lt;br /&gt;
http://sybasease.blogspot.com/2005/05/nulls-in-sybase-ase.html&lt;/p&gt;
</description>
 <pubDate>Fri, 27 Jan 2006 22:11:29 +0000</pubDate>
 <dc:creator>Robert Vollman</dc:creator>
 <guid isPermaLink="false">comment 1812 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title></title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comment-1811</link>
 <description>&lt;p&gt;I think you&#039;re just coding around the fundamental problem.  And it&#039;s a good workaround - exactly the same one I&#039;d use.&lt;/p&gt;
&lt;p&gt;Try this for a different example: We&#039;re writing a Kevin Smith database.  We need a column that holds everything Silent Bob says in a given scene.  We already know what he says, beyond doubt.  It&#039;s NOT NULL, because it&#039;s perfectly well known, and in most scenes it&#039;s, &quot;&quot;.&lt;/p&gt;
</description>
 <pubDate>Fri, 27 Jan 2006 16:33:53 +0000</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">comment 1811 at http://cafe.jenkster.com</guid>
</item>
<item>
 <title>Dumb, Dumber and Dumbest - 3 Stupid Database Things</title>
 <link>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas</link>
 <description>&lt;p&gt;Last Friday &lt;a href=&quot;http://www.johnsy.org&quot;&gt;Pete&lt;/a&gt; and I were talking about database stupidity.    Not programming stupidity, though we weren&#039;t wanting for &lt;a href=&quot;http://www.thedailywtf.com/forums/39000/ShowPost.aspx&quot;&gt;a good example&lt;/a&gt;, but the woeful stupidity of the underlying database system.  That conversation has started me off on a bit of a rant, which begins with the stupidy of Microsoft, and then heads through Oracle to finally show that MySql is Teh Stupidest Database Ever.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Contender #1: &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; Server&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It begins when Pete &amp;amp; I learned that &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; Server will allow you do this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CREATE UNIQUE INDEX test_idx ON test ( id ) IGNORE_DUP_KEY;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Wow.  Yes, you read it right - &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; Server allows you to create a unique index with duplicate values.  &quot;There are no duplicates, except for the ones that are.&quot;  Jeez.  Surely that&#039;s the stupidest database ever, right?  Surely there couldn&#039;t be something dumber than that?&lt;/p&gt;
&lt;p&gt;Actually, it can get worse.  The house may be shoddy, but the real rot starts in the  foundations...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Interlude - What IS &lt;span class=&quot;caps&quot;&gt;NULL&lt;/span&gt;?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Normally, logical statements have 2 values: &lt;span class=&quot;caps&quot;&gt;TRUE &lt;/span&gt;or &lt;span class=&quot;caps&quot;&gt;FALSE. &lt;/span&gt; Databases use tri-state logic that allows a third value, &lt;span class=&quot;caps&quot;&gt;NULL.  NULL &lt;/span&gt;is a place-holder for, &quot;we don&#039;t know what value it is.&quot;&lt;/p&gt;
&lt;p&gt;Databases go a little further than that in fact, allowing both definite and &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;values for different types of data.  So you can have a specific age, like 28, or a &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;age, meaning, &quot;We don&#039;t (yet) know this person&#039;s age.&quot;&lt;/p&gt;
&lt;p&gt;But, but, but - &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;is not a &lt;i&gt;real&lt;/i&gt; value.  &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;isn&#039;t like true or false or 9 or &quot;Bobby McGee&quot; - it&#039;s a placeholder for the unknown.  (Much like the bottom of someone&#039;s handbag.)  It doesn&#039;t represent something specific.  It represents the lack of specificity&lt;sup class=&quot;footnote&quot;&gt;&lt;a href=&quot;#fn1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;So now we&#039;re clear, on with the stupidity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Contender #2: Oracle&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Imagine I&#039;m writing a military security database.  One table records all the details of people allowed access to the secure information.  So the Captain phones me up and specifies that, &quot;We &lt;strong&gt;must&lt;/strong&gt; know the rank of every person with access.&quot;  Fair enough says I, there&#039;s a table called &lt;span class=&quot;caps&quot;&gt;PERSON, &lt;/span&gt;and it will have a column called &lt;span class=&quot;caps&quot;&gt;RANK. &lt;/span&gt; And the value for rank &lt;strong&gt;must&lt;/strong&gt; be known.  Rather handily, my database will support this demand:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;CREATE TABLE person (&lt;br /&gt;
...&lt;br /&gt;
rank               CHAR     NOT NULL&lt;br /&gt;
...&lt;br /&gt;
);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;See that &#039;NOT &lt;span class=&quot;caps&quot;&gt;NULL&#039; &lt;/span&gt;instruction there?  Bob&#039;s my uncle, and the database will automatically guarantee that we can&#039;t create a &lt;span class=&quot;caps&quot;&gt;PERSON &lt;/span&gt;record unless we specify their &lt;span class=&quot;caps&quot;&gt;RANK. &lt;/span&gt; Step forward Oracle to bugger it all up.&lt;/p&gt;
&lt;p&gt;The Captain, being an old pal of mine, gives me access to the secure information.  I phone up his rather dishy secretary to get my details put in the database, and she asks me what my rank is.  That&#039;s easy - I don&#039;t have a rank; I&#039;m a civilian.&lt;/p&gt;
&lt;p&gt;Here&#039;s where Oracle fluffs it.&lt;/p&gt;
&lt;p&gt;You see my rank, the rank of Kris Jenkins, is, was and probably always will be &lt;em&gt;none&lt;/em&gt;.  No rank.  Rank = &quot;&quot;.  It&#039;s not that we don&#039;t know my rank - my rank is not a matter for question or further investigation - we know it very clearly.  I don&#039;t have one.&lt;/p&gt;
&lt;p&gt;Do you see the difference?  Oracle doesn&#039;t.  The secretary dutifully puts in &quot;&quot; as my rank, and Oracle baulks because it thinks &quot;&quot; IS &lt;span class=&quot;caps&quot;&gt;NULL. &lt;/span&gt; It&#039;s not.  &quot;&quot; is &lt;strong&gt;not&lt;/strong&gt; an unknown value.  It&#039;s a very clearly-defined empty string.  This is a fundamental flaw in Oracle.&lt;/p&gt;
&lt;p&gt;I could bang my head against the table all day, but hopefully you see more clearly than the big O, and you&#039;re ready to move on to the stupidest database in the world, ever.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Contender #3: MySql&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Code says it all here.  Just look at this lunacy:&lt;/p&gt;
&lt;pre&gt;
   mysql&amp;gt; create table test (
       -&amp;gt;   id           integer      not null,
       -&amp;gt;   description  varchar(200)
       -&amp;gt; );
   Query OK, 0 rows affected (0.00 sec)

   mysql&amp;gt; insert into test ( description ) values ( &#039;Is this a load of rubbish?&#039; );
   Query OK, 1 row affected (0.01 sec)

   mysql&amp;gt; select * from test;
   +----+----------------------------+
   | id | description                |
   +----+----------------------------+
   |  0 | Is this a load of rubbish? |
   +----+----------------------------+
   1 row in set (0.00 sec)&lt;/pre&gt;&lt;p&gt;Oh.  My.  God.  It&#039;s a database that actually says, &quot;Damn!  ID is a &lt;span class=&quot;caps&quot;&gt;NOT NULL &lt;/span&gt;column.  Let&#039;s silently make something up!&quot;&lt;br /&gt;
Make it up?!?  You&#039;re inventing data for me?!  Why in the name of Alan Turing are you doing that&lt;sup class=&quot;footnote&quot;&gt;&lt;a href=&quot;#fn2&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;?&lt;/p&gt;
&lt;p&gt;Mysql - kindly bugger off and leave us alone.  You are Teh Stupidest Database Ever.&lt;/p&gt;
&lt;p class=&quot;footnote&quot; id=&quot;fn1&quot;&gt;&lt;sup&gt;1&lt;/sup&gt; Incidentally, this is why your database will baulk if you say, &lt;code&gt;WHERE NULL = NULL&lt;/code&gt;.  We can&#039;t say that &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;equals &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;because we don&#039;t know what value the first &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;is, and we don&#039;t know what value the second &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;is.  It might turn out that the first is &quot;5&quot; and the second is &quot;5&quot;; or that the first is &quot;5&quot; and the second is &quot;Zebra&quot;.  We simply don&#039;t know, and until we find out we can&#039;t say that this &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;= that &lt;span class=&quot;caps&quot;&gt;NULL, &lt;/span&gt;or even this &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;!= that &lt;span class=&quot;caps&quot;&gt;NULL, &lt;/span&gt;but only that a particular &lt;span class=&quot;caps&quot;&gt;NULL &lt;/span&gt;&lt;i&gt;is&lt;/i&gt; null.&lt;/p&gt;
&lt;p class=&quot;footnote&quot; id=&quot;fn2&quot;&gt;&lt;sup&gt;2&lt;/sup&gt;  For the record, here&#039;s how a real database reacts:&lt;/p&gt;
&lt;pre&gt;postgres=&amp;gt; create table test (
postgres(&amp;gt;   id          integer      not null,
postgres(&amp;gt;   description varchar(200)
postgres(&amp;gt; );
CREATE TABLE
postgres=&amp;gt; insert into test ( description ) values ( &#039;Is this a load of rubbish?&#039; );
ERROR:  null value in column &amp;quot;id&amp;quot; violates not-null constraint


postgres=&amp;gt; create table test2 (
postgres(&amp;gt;   rank        varchar(20)  not null,
postgres(&amp;gt;   description varchar(200)
postgres(&amp;gt; );
CREATE TABLE
postgres=&amp;gt; insert into test2 ( rank, description ) values ( &#039;&#039;, &#039;My rank is well defined.&#039; );
INSERT 12389614 1
&lt;/pre&gt;</description>
 <comments>http://cafe.jenkster.com/permalink/cafe/dumb_dumber_and_dumbest_3_stupid_databas#comments</comments>
 <category domain="http://cafe.jenkster.com/general/geekpost">Geekpost</category>
 <pubDate>Tue, 26 Jul 2005 13:49:05 +0100</pubDate>
 <dc:creator>Kris</dc:creator>
 <guid isPermaLink="false">853 at http://cafe.jenkster.com</guid>
</item>
</channel>
</rss>
