Re: Trying to add primary key to existing database.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Carter wrote:
Hi,

I have a database, which was till now, not having any primary key defined. I
thought I would not need it but now I think I do (based on the suggestions
from my prior postings). I am now trying to insert the primary key in an
already existing database. There was not even an index defined earlier
(sorry, if it looks strange). There are many columns that have same names
this means that I cannot make that column the primary key.

I have now got an idea to first define index on the table and then make the
index thing the primary key. I have mySql on cPanel. please advice how to
achieve this on an existing database in cPanel php admin.

Any link or steps would help. I tried it myself but there is something it
wants to tell me, that I am not sure about.

Most likely not everything can be done through phpmyadmin, however you can add your own primary key easily:

alter table tablename add id int not null auto_increment primary key;

See http://dev.mysql.com/doc/refman/4.1/en/alter-table.html

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux