Jump to content

[SOLVED] ... Cant make a row with auto_increment


ccrevcypsys

Recommended Posts

I am working on this website that some dumb ass made. And i am makeing it to where you can edit a table called `courses` and i am trying to add an main `id` column because the dumb ass who made it didnt put one. And now everytime i do this i get this error

 

Error

 

SQL query:

 

ALTER TABLE `courses` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT

 

MySQL said: Documentation

#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

 

And i look up on mysql documentation website and it just repeated the same thing couldn't find a way to fix this... Can someone please help me?

Ok i get this error every time i do that...

 

Error

 

SQL query:

 

ALTER TABLE `courses` CHANGE `id` `id` INT( 11 ) NULL AUTO_INCREMENT

 

MySQL said: Documentation

#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

 

then i try to define it as a key and get this one

 

Error

 

SQL query:

 

ALTER TABLE `courses` ADD PRIMARY KEY ( `id` )

 

MySQL said: Documentation

#1062 - Duplicate entry '0' for key 1

 

Then everytime i delete it and try again i get the same 2 damn errors!

This is very frustrating

 

Indexes: Documentation

Keyname-----------Type--------Cardinality------Action---Field

DrKey--------------INDEX-------253-------Edit----Drop----DrKey

EventKey----------INDEX--------23 -------Edit----Drop----EventKey

 

this is all that resides at the bottom

Okay first of all, dont use INDEX if you dont know what it means please. Undo those changes, they dont need to me indexes.

 

DrKey--------------INDEX-------253-------Edit----Drop----DrKey

EventKey----------INDEX--------23 -------Edit----Drop----EventKey

 

 

only 1 INDEX per table is good, and it should be the auto_increment.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.