Solved

primary key confusion

Posted on 2013-06-27
3
289 Views
Last Modified: 2013-06-28
Hi,

In phpmyadmin I cant alter tables to get the primary key.  I want to set a primary key with autonumber and I know I check on a-I on creating a field .

If you see the img I have a field with PK that I cant undo the PK and I cant add a autonumber field as a PK as I get an error (need a PK)
mysql.docx
0
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39281685
Consider recreating the table.  You might write a little script to copy the data to the new table.
0
 
LVL 58

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39281748
You shouldn't have to recreate the table.

What do you see when you edit (Change) the record - your version of PHPMyAdmin differs from the versions I am using

Have you tried running a query to do this
ALTER TABLE tbmod1 
   CHANGE `section` `section` INT(11) NOT NULL, 
   CHANGE `q1` `q1` INT(11) NOT NULL AUTO_INCREMENT,
   DROP PRIMARY KEY, 
   ADD PRIMARY KEY(`q1`)

Open in new window

Remember though before you can make a column a auto increment the column has to have unique values otherwise it will fail.
Also check if there are any relationships setup on the table which might be interferring.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39283611
Please use image files like JPGs for screen shots.  They will open in the browsers where 'docx' files require us to start up another program.  I usually won't do that and I haven't looked at your file.
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question