Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PRIMARY KEY in MySQL

Status
Not open for further replies.

thegman

Programmer
Oct 16, 2001
26
GB
Is there a way to find out what the PRIMARY KEY is in a table? i.e. can I say 'SELECT PRIMARY KEY FROM mytable' and get the name of the column which is the primary key?

Thanks a lot.
 
Does MySql have an utility program to create and alter tables? With this type of program you can see the structure of the database and all related items. S. van Els
SAvanEls@cq-link.sr
 
Sorry, I did'nt make myself clear on one point, I need to do this from inside Perl using the DBI, I know what the Primary key is, I made it, but I need to ask what it is from Perl. I made a workaround by doing EXPLAIN table, and regexp'ing it out of there, but I thought there would be a nicer way.

Thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top