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

2018-11-27 10:37 更新

sql语句:

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 type2


FROM
    information_schema. COLUMNS
WHERE
    TABLE_NAME = 't_bridge'
ORDER BY
    ordinal_position;

结果:

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号