开发者

SHOW FIELDS but with filter on field type?

开发者 https://www.devze.com 2022-12-17 05:59 出处:网络
I have a mySQL database with a number of tables with many fiel开发者_高级运维ds. Is there a native way to find only the fields of the type TEXT?

I have a mySQL database with a number of tables with many fiel开发者_高级运维ds.

Is there a native way to find only the fields of the type TEXT?

I know how to do it using a scripting language like PHP. I just want to know whether there is a trick using SHOW TABLES/SHOW FIELDS I am not aware of.


For MySQL 5+ you can query INFORMATION_SCHEMA:

SELECT 
    TABLE_NAME, COLUMN_NAME
FROM 
    INFORMATION_SCHEMA.COLUMNS
WHERE 
    DATA_TYPE = 'TEXT';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号