Jump to content

Archived

This topic is now archived and is closed to further replies.

Rogue3

When to use the 'null' option

Recommended Posts

I have a field in my form (varchar(80)) that I don't always enter information for. It's an "additional keyword" field used to put additional keywords for my search form. Right now I have it to where it is just blank, but should I have it set to 'null' if there is no info there? Will this affect the search one way or the other?

Share this post


Link to post
Share on other sites
it won't affect the search, really, but it may help in your queries to have it NULL as opposed to an empty string. they [b]are not[/b] the same thing. an empty string still has memory allocated to store it, while a NULL is a truly empty value. setting your table to default NULL is usually a good idea.

Share this post


Link to post
Share on other sites
Having NULL-able fields make a big difference... use it only when you actually care about knowing that values where unspecified vs. blank.  Otherwise, it makes querying, indexing, joining, etc. more complicated.

Share this post


Link to post
Share on other sites
Well, the field that can sometimes be left blank is going to be a searchable field, but not a field that will display on the results page.

Share this post


Link to post
Share on other sites
Doesn't matter what the public sees... it only matters if you need to know the difference.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.