Free Advertising - Find services - Wordpress Themes - Free Articles Directory About Cancer - Wordpress Themes

PDA

View Full Version : NULL or NOT NULL


mahmood
Jun 20th 2006, 10:08 am
What are the differences of a NULL column and NOT NULL?

Which one do you think is better?

frankcow
Jun 20th 2006, 10:34 am
do you mean in the table definition? as in ALLOW NULL values?

rosytoes
Jun 20th 2006, 10:52 am
It's not a question of which is better. It's rather a question of which is necessary. NOT NULL are used for primary keys.

pelican
Jun 20th 2006, 7:50 pm
it depends if that field is a required field. you definitely do not want NULL to be in a required field.

infonote
Jun 21st 2006, 12:20 am
According to what you want. In a recent site i made with Java and c#, i did not tick the not null in the db, but programmatically made it nexessary to include that field.

ClearVisionDesigns.co.uk
Jun 22nd 2006, 7:03 am
You should always try and advoid having null fields in a database (bad design practice)

specifiying a field as NOT NULL means when you insert a new record you will always have a value to fill that column. It allows the dabase system to optermise your database.

iconv
Jun 26th 2006, 12:14 am
Declaring NOT NULL also saves one bit on storage and makes indexes potentially more efficient.