943,650 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 8728
  • MySQL RSS
Sep 15th, 2008
0

What is the main Differences between Null value and blank?

Expand Post »
Can anyone explain me what are the main difference between a null value and blank value in database. It important please help me out. thank you.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dharam_05 is offline Offline
22 posts
since Aug 2008
Sep 15th, 2008
0

Re: What is the main Differences between Null value and blank?

1.A NULL value represents the absence of a value for a record in a field (others softwares call it also a missing value).

2.An empty value is a "field-formatted" value with no significant data in it.

3.NULL isn't allocated any memory, the string with NUll value is just a pointer which is pointing to nowhere in memory. however, Empty IS allocated to a memory location, although the value stored in the memory is "".

4.Null has no bounds, it can be used for string, integer, date, etc. fields in a database. Empty string is just regarding a string; it's a string like 'asdfasdf' is, but is just has no length. If you have no value for a field, use null, not an empty string.

5.Null is the database's determination of an absense of a value logically, so to speak. You can query like: where FIELD_NAME is NULL
Last edited by Shanti C; Sep 15th, 2008 at 4:22 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Sep 15th, 2008
0

Re: What is the main Differences between Null value and blank?

Good explanation shanti.

I would also say that null is much easiet to query for than a blank value.
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Sep 16th, 2008
0

Re: What is the main Differences between Null value and blank?

Thanks guys but i have one query, if i have some null values and some empty string in the table and if i execute select * from from table. whether it will print fields having null and empty string ? what will be the o/p?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dharam_05 is offline Offline
22 posts
since Aug 2008
Sep 16th, 2008
1

Re: What is the main Differences between Null value and blank?

select * from tablename;
this statement will print all the columns, not the matter of null or empty..
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Sep 16th, 2008
0

Re: What is the main Differences between Null value and blank?

if you need to filter out empty strings
MySQL Syntax (Toggle Plain Text)
  1. SELECT * FROM table WHERE LENGTH(COLUMN) > 0

filter out nulls
MySQL Syntax (Toggle Plain Text)
  1. SELECT * FROM table WHERE COLUMN IS NOT NULL

if you need both, just combine
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Dec 4th, 2009
0
Re: What is the main Differences between Null value and blank?
i use this on a daily basis
sql Syntax (Toggle Plain Text)
  1. SELECT * FROM table WHERE isnull(COLUMN,'') = ''
or other variations ....
sql Syntax (Toggle Plain Text)
  1. SELECT * FROM table WHERE NOT isnull(COLUMN,'') = ''
  2. SELECT * FROM table WHERE isnull(COLUMN,'') <> ''
Last edited by peter_budo; Dec 12th, 2009 at 3:35 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bwagner is offline Offline
1 posts
since Dec 2009
Sep 17th, 2011
0
Re: What is the main Differences between Null value and blank?
Although this is an old thread, I'm adding to it because it appears high in searches on the difference between null and an empty string.

This discussion and many other highly ranked discussions of the topic omit another critical difference: When a field is specified as UNIQUE, there can be multiple records with NO VALUE (i.e. NULL) in that field, but of course there cannot be multiple records with the SAME VALUE (e.g. the empty string) in the field.

That is both a logical and a useful characteristic of NULL, but not a characteristic one would like to discover late in the game.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Stålhandske is offline Offline
1 posts
since Sep 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: [split] UPDATE with SELECT
Next Thread in MySQL Forum Timeline: trigger an update query if that record was not update within 10 minutes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC