Rob, > I'm not questioning what MySQL does, only how. MySQL does not "act" > without a request, so my question is (now), "How do you ask MySQL > what the PRIMARY KEY of a table is?
SHOW KEYS FROM tbl In an application, next thing you would do is check what the value of 'Key_name' is (which is the column name of the returned result set), and if it is 'PRIMARY', then you have the PK. I don't know how (ODBC) apps like MS Access would "ask" MySQL for a PK column of a table, but MySQL must have a built-in mechanism to "answer" such a question with something else but the value 'PRIMARY'. Maybe some guru on the list has a more precise information?! > P.S. I lived/worked in Berlin 1984-85 developing an RDBMS for > Siemens on a joint project w. Intel. It never reached the > market. Great City!! I miss alt bier. :-) Regards, -- Stefan Hinz <[EMAIL PROTECTED]> Geschäftsführer / CEO iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 ----- Original Message ----- From: "Rob Pecherer" <[EMAIL PROTECTED]> To: "Stefan Hinz, iConnect (Berlin)" <[EMAIL PROTECTED]> Sent: Saturday, January 18, 2003 7:57 PM Subject: RE: PRIMARY KEY > Greetings Stefan, and thanks. > > I'm not questioning what MySQL does, only how. MySQL does not "act" > without a request, so my question is (now), "How do you ask MySQL > what the PRIMARY KEY of a table is? > > Thanks, Rob > > P.S. I lived/worked in Berlin 1984-85 developing an RDBMS for > Siemens on a joint project w. Intel. It never reached the > market. Great City!! I miss alt bier. > > -----Original Message----- > From: Stefan Hinz, iConnect (Berlin) [mailto:[EMAIL PROTECTED]] > Sent: Saturday, January 18, 2003 11:35 AM > To: Rob Pecherer; [EMAIL PROTECTED] > Subject: Re: PRIMARY KEY > > > "If you don't have a PRIMARY KEY and some applications ask for the > > PRIMARY KEY in your tables, MySQL will return the first UNIQUE key, > > > How does any application "ask for the PRIMARY KEY"? Is this an > > ODBC call, or are their command line and built-in functions? I > > couldn't find this in the documentation. > > Primarily, this is a feature for ODBC applications like MS Access. I > don't know of any other app that really longs to have a primary key for > each table, but if there were such apps, MySQL would act as described in > the manual (with or without ODBC). > > Regards, > -- > Stefan Hinz > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php