<?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>Inside the Web &#187; Database</title>
	<atom:link href="http://webindoors.com/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://webindoors.com</link>
	<description>[&#34;Web 2.0&#34;, &#34;Ruby&#34;, &#34;RoR&#34;] &#60;&#60; &#34;me&#34;</description>
	<lastBuildDate>Sun, 18 Apr 2010 13:09:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Importance of NULL in MYSQL</title>
		<link>http://webindoors.com/2009/09/27/this-is-testing-post/</link>
		<comments>http://webindoors.com/2009/09/27/this-is-testing-post/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 13:25:44 +0000</pubDate>
		<dc:creator>Ankur</dc:creator>
				<category><![CDATA[Database]]></category>

		<guid isPermaLink="false">http://webindoors.com/?p=16</guid>
		<description><![CDATA[At the time of creation of any table, one should take care of defining the fields like datatype, datasize etc.
Apart from these we should also take care of whether the field value can be NULL (no value) or not.
What is NULL in mysql ? -
The NULL value is special; because it means “no value”. It [...]]]></description>
			<content:encoded><![CDATA[<p>At the time of creation of any table, one should take care of defining the fields like datatype, datasize etc.<br />
Apart from these we should also take care of whether the field value can be NULL (no value) or not.</p>
<p>What is NULL in mysql ? -</p>
<p>The NULL value is special; because it means “no value”. It is basically a condition, to check whether particular field value is null or not.</p>
<p>If we are not defining the column NOTNULL than MYSQL make it NULL by-default. But We shouldn’t define fields as NULL for any field due to some following reasons -</p>
<ul>
<li>If you make any field NULL, it requires more storage      space and requires special processing inside MYSQL.</li>
</ul>
<ul>
<li>A nullable column requires extra byte per entry on the      time of indexing a column.</li>
</ul>
<ul>
<li>Its harder for MYSQL to optimize queries that refer to      nullable column because nullable columns make indexes   and      comparisions to value becomes more complicated inside MYSQL.</li>
</ul>
<p>So, We should define fields as NOT NULL whenever We can.</p>
<p>For Eg. We need to make a table of Oscar awarded singers with columns: firstname , lastname, city, birthdate, death:<br />
All singers will have firstname, lastname, city and birthdate but there can be lot of singers who has been expired.<br />
So, we can put only deathdate column NULL.</p>
<p>CREATE TABLE singers<br />
(<br />
lastname VARCHAR(15) NOT NULL,<br />
firstname VARCHAR(15) NOT NULL,<br />
city VARCHAR(20) NOT NULL,<br />
birthdate  DATE NOT NULL,<br />
deathdate DATE NULL<br />
)</p>
<p>So never forget to define NOTNULL  to any field on which any value must exist….</p>
<p>Hope it will help for your MYSQL optimization….</p>
]]></content:encoded>
			<wfw:commentRss>http://webindoors.com/2009/09/27/this-is-testing-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
