Reputation: 708
I've added a question on most of the solved problem with regards to COLUMN_NAME searching but didn't get any feedback yet.
How to do a query that goes like this:
I want to see all the tables that has a column name of 'Type_ID' and must be a Primary key to the table.
Upvotes: 3
Views: 2520
Reputation: 562611
SELECT table_schema, table_name
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE (table_schema, column_name, constraint_name)
= ('mydatabase', 'Type_ID', 'PRIMARY');
Upvotes: 5