On Sunday 08 August 2004 22:13, Justin French wrote:
> Can someone give me a quick/clear explanation about why you would
> create a table with columns of NULL / NOT NULL?
>
> I clicked around the MySQL manual last night I *think* I know what's
> what, but it'd be great to read one clear paragraph that summarises it
> all.

A NULL is the equivalent of saying "I don't know" whereas a 0 means the value 
between -1 and 1 and a blank means 'no value'. For example... suppose you're 
recording temperatures at various locations.

Sydney         <blank>
Perth             0
Airlie Beach   null

It pretty clear that the temperature in Perth is 0, which is not the same as 
being empty.

The difference between null and blank is a bit more subtle. null means that 
you don't know what the value is - if the folks in Airlie Beach say that their 
thermometer is broken, they have reported their results, but their results 
are "we have no idea how cold it is here". You use a blank in Sydney until 
you hear from them, at which time you either have a temperature (an actual 
number), or you have another "We have no idea how cold it is outside because 
our thermometer is broken too." which means null again.

Does that help?

-- 
Whil

Moving to Linux: Freedom, Choice, Security, Opportunity
http://www.hentzenwerke.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to