MYSQL (WAMP SERVER): Error 1064 when creating table column with AUTO_INCRMENT=1000?
P粉681400307
P粉681400307 2024-03-29 20:35:14
0
1
446

I have this code: CREATE TABLE Company ( Comp_Code INT(5) NOT NULL AUTO_INCRMENT=1000, Comp_Name VARCHAR(15) NOT NULL, primary key (Comp_Code) ); But when I run it in MYSQL from WAMPServer, I get the error:

Error 1064 (42000): There is an error in your SQL syntax; check the manual for your MySQL server version for the correct syntax to use around '=1000, Comp_Name VARCHAR(15) NOT NULL, Primary key (Comp_Code) )' on line 2

Why does this happen?

P粉681400307
P粉681400307

reply all(1)
P粉569205478

AUTO_INCRMENT is a column option.

Initial AUTO_INCRMENT=1000 The value is the table option.

CREATE TABLE Company ( 
    Comp_Code INT(5) NOT NULL AUTO_INCREMENT,  -- specify that the column is AI
    Comp_Name VARCHAR(15) NOT NULL, 
    PRIMARY KEY (Comp_Code) 
) AUTO_INCREMENT=1000;                         -- specify initial AI value
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template