Search the web
Sign In
New User? Sign Up
baseball-databank · Baseball Databank
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
ZERO vs NULL   Message List  
Reply | Forward Message #3566 of 3880 |
From the standpoint of an Oracle programmer/dba there is a difference between a 0 and a NULL.
 
A zero is a value.  It's value is ZERO.
 
A null by definition is an ABSENCE of a value.
 
If you're not careful with the above distinctions you could default a value to 0 when it should actually remain a NULL and by doing so throw off statistics.
 
For example a table with 10 rows of values:
 
In the first - 5 values defaulted to 0 and 5 values with actual values.  The average of the values in table is 1.5
 
0
0
0
0
0
1
2
3
4
5
 
In the second table - 5 values NOT defaulted to 0 and the same 5 actual values as the first.  The average of the values in this table is 3.
 
NULL
NULL
NULL
NULL
NULL
1
2
3
4
5
 
The difference is in the first table the average function AVG() is using ALL the values even the 0 values.  In the second the NULL values don't exist so the AVG() function is only using the 5 values it knows about.


Fri May 2, 2008 3:57 pm

dldietz2001
Online Now Online Now
Send Email Send Email

Forward
Message #3566 of 3880 |
Expand Messages Author Sort by Date

From the standpoint of an Oracle programmer/dba there is a difference between a 0 and a NULL. A zero is a value. It's value is ZERO. A null by definition is...
Dereck L. Dietz
dldietz2001
Online Now Send Email
May 5, 2008
3:46 pm

... This is consistent with how we are handling it. If you have an example contrary to this, please let us know. Tom...
Tangotiger
tom@...
Send Email
May 6, 2008
3:05 pm

This doesn't apply to just Oracle. It is a consideration in other databases I understand. Tom Stillman ... ...
Tom Stillman
giantsfan_94121
Offline Send Email
May 6, 2008
3:59 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help