Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

primary key confusion

Posted on 2013-06-27
3
Medium Priority
?
292 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 111

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 59

Accepted Solution

by:
Julian Hansen earned 2000 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 84

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, we’ll look at how to deploy ProxySQL.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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