Matthew
Matthew

Reputation: 87

Select columns that have a specific type

I want to get all columns' names that have a specific type, for example I want to print all the columns' names with int type. How do I do that?

Upvotes: 1

Views: 299

Answers (1)

user330315
user330315

Reputation:

You can use information_schema.columns for that:

select table_schema, table_name, column_name
from information_schema.columns
where data_type = 'integer';

Upvotes: 3

Related Questions