Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: databse
Hi guys,
 
What is the difference between Empty/Blank , Null and NotNull database field.
how many default memory space occupied by them.
 
Thanks
Ravik
Posted 11-Dec-12 7:13am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is no special empty or blank value. Usually string (char, varchar, nvarchar, text, stb...) fields that contain no characters are called empty or blank. But an empty string is not null. Null is a special value that denotes the field not to be populated with any data. It is "nothing". Thus theoretically null values are not used in aggregate calculations, and if involved in an arithmetical calculation they make the whole formula undefined/null (dbms implementation might treat null values slightly different).
The space occupied is a more complex question. Since any data type can hold null value (concrete fields might be marked as not nullable, sometimes derived types also), the space occupied by a null value in the database itself depends on the data type. In case of a scalar, or a fixed maximum width string (in this case char and varchar behave the same way) field, there is no difference with null value or filled. In case of undefined variable length fields like TEXT (deprecated) or VARCHAR(MAX), a null value will occupy a single block.
In the memory of the dbms and of the program it is even more complicated. I have to say, that it depends on the native data types used, and of course of the coder.
Optimization is used in case of the major dbms providers, but is most cases performance is more important than bytes consumed.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 BillWoodruff 360
1 Mathew Soji 309
2 Maciej Los 270
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 202
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100