List:General Discussion« Previous MessageNext Message »
From:Scott Purcell Date:July 5 2005 8:21pm
Subject:null data in table question
View as plain text  
Hello,

I have created a web-based simple application, and used mysql for data storage. All has
worked well. But I do have a simple question I would like to ask the group.

I have some web-based forms that match table structure. Most of the important fields have
validation, and I ensure good data into the table. But I have a few columns in the table
such as "middleInitial" where I do not validate the data. And in the database is shows a
null when I do a select * from.

Is a null acceptable in the database, or is there something I should do on columns that
the user may not put in data?


Currently my tables are simple like so.

CREATE TABLE `user` (
  `id` int(11) NOT NULL auto_increment,
  `modified_date` timestamp(14) NOT NULL,
  `created_date` timestamp(14) NOT NULL,
  `username` varchar(50) NOT NULL default '',
  `firstname` varchar(25) default NULL,
  `initial` char(1) default NULL,
  `lastname` varchar(25) default NULL,
  `company` varchar(50) default NULL,
  `address1` varchar(50) default NULL,
  `address2` varchar(50) default NULL,
  `city` varchar(50) default NULL,
  `state` char(2) default NULL,
  `zip` varchar(5) default NULL,
  `phone` varchar(12) default NULL,
  `eveningPhone` varchar(12) default NULL,
  `email` varchar(50) default NULL,
  `password` varchar(50) default NULL,
  `admin` char(1) NOT NULL default 'F',
  `hintchoice` char(1) default NULL,
  `hintvalue` varchar(50) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=InnoDB;


Thanks for any input, as I am learning.

Scott
Thread
null data in table questionScott Purcell5 Jul
  • Re: null data in table questionSGreen5 Jul
  • Re: null data in table questionMartijn Tonies5 Jul
    • Re: null data in table questionmfatene6 Jul