473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

When to use 'NOT NULL' in tables...


Folks,

My database receives HTML form values (text, I don't store binary files in
any of my tables). When is it adviseable to create a table column with NOT
NULL? I make a habit of having all my table columns this way but wonder if
I am just putting additional overhead (however small) on the server and
getting zero advantages...

Anyone comment? via the newsgroup please... so others can learn... thanks,
randell d.
Jul 19 '05 #1
6 12486
"Randell D." <re**********************@and.share.com> wrote in message news:<2foIb.871500$pl3.759769@pd7tw3no>...
Folks,

My database receives HTML form values (text, I don't store binary files in
any of my tables). When is it adviseable to create a table column with NOT
NULL? I make a habit of having all my table columns this way but wonder if
I am just putting additional overhead (however small) on the server and
getting zero advantages...

Anyone comment? via the newsgroup please... so others can learn... thanks,
randell d.


I believe that NULL is better than NOT NULL, because NULL is the
default. The MySQL programmers would probably have a good reason for
that. I don't know what that reason is, however.

Bart
Jul 19 '05 #2
"Randell D." <re**********************@and.share.com> wrote in message news:<2foIb.871500$pl3.759769@pd7tw3no>...
Folks,

My database receives HTML form values (text, I don't store binary files in
any of my tables). When is it adviseable to create a table column with NOT
NULL? I make a habit of having all my table columns this way but wonder if
I am just putting additional overhead (however small) on the server and
getting zero advantages...

Anyone comment? via the newsgroup please... so others can learn... thanks,
randell d.


I believe that NULL is better than NOT NULL, because NULL is the
default. The MySQL programmers would probably have a good reason for
that. I don't know what that reason is, however.

Bart
Jul 19 '05 #3
> "Randell D." <re**********************@and.share.com> wrote in
message news:<2foIb.871500$pl3.759769@pd7tw3no>...
Folks, When is it adviseable to create a table column with NOT NULL?


When the nature of the real world data you are modeling is such that
NULL is not a possible value. That is, a situation where a known
value is always available and an unkown value is not possible or
acceptable.

You should allow NULL in any column where "I don't know" is a possible
answer. Remember, NULL is NOT the same as zero. Zero means nothing
or none, which is a definite value.
Jul 19 '05 #4
> "Randell D." <re**********************@and.share.com> wrote in
message news:<2foIb.871500$pl3.759769@pd7tw3no>...
Folks, When is it adviseable to create a table column with NOT NULL?


When the nature of the real world data you are modeling is such that
NULL is not a possible value. That is, a situation where a known
value is always available and an unkown value is not possible or
acceptable.

You should allow NULL in any column where "I don't know" is a possible
answer. Remember, NULL is NOT the same as zero. Zero means nothing
or none, which is a definite value.
Jul 19 '05 #5

"Ed Seedhouse" <es********@shaw.ca> wrote in message
news:pa****************************@shaw.ca...
"Randell D." <re**********************@and.share.com> wrote in

message news:<2foIb.871500$pl3.759769@pd7tw3no>...
Folks, When is it adviseable to create a table column with NOT NULL?


When the nature of the real world data you are modeling is such that
NULL is not a possible value. That is, a situation where a known
value is always available and an unkown value is not possible or
acceptable.

You should allow NULL in any column where "I don't know" is a possible
answer. Remember, NULL is NOT the same as zero. Zero means nothing
or none, which is a definite value.
--
====================================
Thanks for that,
Randell D.
Jul 19 '05 #6

"Ed Seedhouse" <es********@shaw.ca> wrote in message
news:pa****************************@shaw.ca...
"Randell D." <re**********************@and.share.com> wrote in

message news:<2foIb.871500$pl3.759769@pd7tw3no>...
Folks, When is it adviseable to create a table column with NOT NULL?


When the nature of the real world data you are modeling is such that
NULL is not a possible value. That is, a situation where a known
value is always available and an unkown value is not possible or
acceptable.

You should allow NULL in any column where "I don't know" is a possible
answer. Remember, NULL is NOT the same as zero. Zero means nothing
or none, which is a definite value.
--
====================================
Thanks for that,
Randell D.
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeremiah Jacks | last post by:
I just upgraded to MySQL 4.0.14-standard for RedHat Linux and am using = the pre-compiled binaries. I have a database with INNODB tables. When I insert a row into one of the child tables, I get...
0
by: Soefara | last post by:
Dear Sirs, I am experiencing strange results when trying to optimize a LEFT JOIN on 3 tables using MySQL. Given 3 tables A, B, C such as the following: create table A ( uniqueId int not...
2
by: AG | last post by:
I have a very big table with 20 million records DistinctProjectionKey which i join several times to different tables in this query. select distinct distinctprojectionkeyid,dpk.MarketID,...
4
by: thilbert | last post by:
All, I have a perplexing problem that I hope someone can help me with. I have the following table struct: Permission ----------------- PermissionId Permission
3
by: Dam | last post by:
Using SqlServer : Query 1 : SELECT def.lID as IdDefinition, TDC_AUneValeur.VALEURDERETOUR as ValeurDeRetour FROM serveur.Data_tblDEFINITIONTABLEDECODES def,...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
2
by: Venkata Narayana | last post by:
Hi, You all may be knowing that Connection.isClosed() does not tells us if the underying DB connection is active or not; it only checks if Connection.close() had been previously called or not....
10
by: teddysnips | last post by:
SQL Server 2000 (DDL below) If I try to run this code in QA: SET IDENTITY_INSERT tblAdminUsers ON INSERT INTO tblAdminUsers (fldUserID, fldUsername, fldPassword, fldFullname,
3
by: nuchphasu | last post by:
Hi I have a problem on Dropdownlist that connect database and retrieve data by Ajax.I write javascript like this -------------------------------------------------------------------------...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.