查詢表格字段,字段類型,并過濾處理

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;

結(jié)果:

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)