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

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;
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號