mysql 查询数据库的所有表格字段

 

 

mysql 查询数据库的所有表格字段

 

 

SELECT 
    TABLE_SCHEMA as `Database`, 
    TABLE_NAME as `Table`, 
    COLUMN_NAME as `Column`, 
    DATA_TYPE as `DataType`, 
    IS_NULLABLE as `IsNullable`, 
    COLUMN_DEFAULT as `Default`, 
      INFORMATION_SCHEMA.COLUMNS.CHARACTER_MAXIMUM_LENGTH  AS `LENGTH`, 
    COLUMN_COMMENT as `Comment`   
FROM     INFORMATION_SCHEMA.COLUMNS
WHERE   TABLE_SCHEMA = 'dbname'          -- 替换为你的数据库名
        and COLUMN_NAME like '%colname%' -- 替换为你的字段名

 

posted @ 2024-08-22 16:50  人生为卒  阅读(13)  评论(0编辑  收藏  举报