In the last episode (Jan 11), Steffan A. Cline said:
> Is there anyway to do a SELECT or DESCRIBE or SHOW statement which can
> return the primary key field of a specified table?
>
> Pseudo code: select primary_key_field_name from mytable.
SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA='myschema' AND TABLE_NAME='mytable'
AND CONSTRAINT_NAME='PRIMARY'
ORDER BY ORDINAL_POSITION;
For multi-column indexes, you will get multiple rows back.
You should also use "show create table mytable" or "show keys from
mytable" but you'll have to do extra parsing.
--
Dan Nelson
[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]