In the following SQL what does the default '0' mean?
Code:category_name varchar(50) NOT NULL default '0',
| SitePoint Sponsor |


In the following SQL what does the default '0' mean?
Code:category_name varchar(50) NOT NULL default '0',

Think it means that because your category_name field cannot be NULL that you mush give it a default value and that value is set to 0.Originally Posted by Googly
Is minic a bhris béal duine a shrón.





Exactly - if you do not enter anything for that field when creating a new row it will have a default value of zero.


And if you don't set this value to default '0' what happens when you insert a row?





If you do not set a value MYSQL will automatically insert a zero for you.


So in MySql it's not really needed?





It depends on your particular requirements for you database whether you use it - it is a feature which can be used or not - your choice!![]()


ok thanks
Bookmarks