4 messages in com.mysql.lists.plusplusRe: primary key?| From | Sent On | Attachments |
|---|---|---|
| Lisa N. Michaud | 18 Apr 2004 12:59 | |
| Gregory Haley | 18 Apr 2004 14:17 | |
| Lisa N. Michaud | 18 Apr 2004 14:20 | |
| Paolo Brandoli | 19 Apr 2004 00:08 |
| Subject: | Re: primary key?![]() |
|---|---|
| From: | Paolo Brandoli (pao...@puntoexe.com) |
| Date: | 04/19/2004 12:08:13 AM |
| List: | com.mysql.lists.plusplus |
Execute the following query: show keys from YOUR_TABLE_NAME;
Then browse all the results and find the record where Key_name=PRIMARY. The field's name is stored in Column_name.
Have a nice day. Paolo
----- Original Message ----- From: "Lisa N. Michaud" <lmic...@wheatoncollege.edu> To: <plus...@lists.mysql.com> Sent: Sunday, April 18, 2004 11:21 PM Subject: Re: primary key?
On Sunday, April 18, 2004, at 04:00 PM, Lisa N. Michaud wrote:
Is there a quick way to determine what field(s) is/are serving as the primary key for a given table?
I should have specified that I was looking for a way to figure it out through MySQL++ methods within a C++ program, not on the command line. Thanks for the responses so far, but that hasn't been what I am looking for.
I have figured out ONE way to do it - sending a "DESCRIBE table-name" query and parsing the results for "PRI" showing up in the 'KEY' field.
This is a kludge, so if anyone knows of a better way, do share.
--lisa
Lisa N. Michaud, Assistant Professor of Computer Science Department of Mathematics and Computer Science, Wheaton College lmic...@wheatoncollege.edu http://cs.wheatoncollege.edu/lmichaud
-- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=pao...@puntoexe.com




