Not getting concept of null

Posted by appu on Stack Overflow See other posts from Stack Overflow or by appu
Published on 2010-12-29T13:46:05Z Indexed on 2010/12/29 13:53 UTC
Read the original article Hit count: 142

Filed under:

Hy Guys,

Beginning with mysql. I am not able to grasp the concept of NULL. Check screen-shot (*declare_not_null, link*). In it when I specifically declared 'name' field to be NOT NULL. When i run the 'desc test' table command, the table description shows default value for name field to be NULL.Why is that so?

From what I have read about NULL, it connotes a missing or information that is not applicable. So when I declare a field to be NOT NULL it implies (as per my understanding) that user must enter a value for the name field else the DB engine should generate an error i.e. record will not be entered in DB. However when i run 'insert into test value();' the DB engine enters the record in table. Check screen-shot(*empty_value, link*).

FLICKR LINKS *declare_not_null* http://www.flickr.com/photos/55097319@N03/5302758813/

*empty_values* Check the second screenshot on flickr

Q.2 what would be sql statemetn to drop a primary key from a table's field. If I use 'ALTER TABLE test drop key id;' it gives the following:

ERROR: Incorrect table definition; there can be only one auto column and it must be defined as a key.

Thanks for your help..

© Stack Overflow or respective owner

Related posts about mysql