Select the primary key for a table


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SELECT k.column_name
  2. FROM information_schema.table_constraints t
  3. JOIN information_schema.key_column_usage k
  4. USING(constraint_name,table_schema,TABLE_NAME)
  5. WHERE t.constraint_type='PRIMARY KEY'
  6. AND t.table_schema='db'
  7. AND t.table_name='tbl';

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.