Return to Snippet

Revision: 10303
at December 17, 2008 03:58 by jachin


Initial Code
SELECT k.column_name
FROM information_schema.table_constraints t
JOIN information_schema.key_column_usage k
USING(constraint_name,table_schema,table_name)
WHERE t.constraint_type='PRIMARY KEY'
  AND t.table_schema='db'
  AND t.table_name='tbl';

Initial URL
http://lists.mysql.com/mysql/204944

Initial Description


Initial Title
Select the primary key for a table

Initial Tags
mysql

Initial Language
SQL