SHOW FIELDS, but with a filter by field type?

I have a mySQL database with multiple tables with many fields.

Is there any own way to find only fields of type TEXT ?

I know how to do this using a scripting language such as PHP. I just want to know if there is a trick using SHOW TABLES / SHOW FIELDS. I dont know.

+4
source share
1 answer

For MySQL 5+, you can query INFORMATION_SCHEMA :

 SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE = 'TEXT'; 
+4
source

Source: https://habr.com/ru/post/1299312/


All Articles