查询表格字段,字段类型,并过滤处理

2018-10-21 18:26 更新
SELECT
    COLUMN_NAME AS name,
    data_type AS type,
    (
        CASE
        WHEN LEFT (data_type, 4) = 'char' THEN 'String'
        WHEN LEFT (data_type, 4) = 'doub' THEN 'float'
        WHEN LEFT (data_type, 4) = 'inte' THEN 'int'
        WHEN LEFT (data_type, 4) = 'time' THEN 'Date'
    else data_type END
    ) AS type


FROM
    information_schema. COLUMNS
WHERE
    TABLE_NAME = 't_bridge'
ORDER BY
    ordinal_position;
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号