MySql Create Table

CREATE TABLE accounts (
product tinytext NOT NULL,
quantity tinytext NOT NULL,
Id int(4) DEFAULT ‘0’ NOT NULL auto_increment,
description tinytext NOT NULL,
price float(10,2) DEFAULT ‘0.00’ NOT NULL,
category char(1) DEFAULT ‘’ NOT NULL,
KEY price (price)

I get an error back saying "Invalid default value for ‘Id’ ", and i dont know whats wrong. Please can somebody tell me what im doing wrong.

Thanks in Advance. :lol:

Did you try to enter the error message in google? Or check out the MySQL DevZone?

As far as I know, you can’t give a default value when you use auto_increment. It could also be that you’re assigning a char or string as a default value to an integer field, which clashes. You’re gonna have to figure out which one it is by yourself though.

Sponsor our Newsletter | Privacy Policy | Terms of Service