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?

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.