SQL 知识点积累

SQL 知识点积累

1、oracle 、msyql、达梦数据字段获取sql
oracle:

select case when a.owner is null then '' else a.owner end,case when a.table_name is null then '' else a.table_name end,case when a.column_name is null then '' else lower(a.column_name) end,case when b.COMMENTS is null then '' else  REPLACE(REPLACE(b.COMMENTS, CHAR(10), '\\u200b'), CHAR(13),'\\u200c') end,to_char(column_id,'99999'),case when a.DATA_TYPE is null then '' else a.DATA_TYPE end,to_char(NVL(DATA_LENGTH,'0'),'99999'),to_char(NVL(a.DATA_PRECISION,'0'),'99999'),to_char(NVL(a.DATA_SCALE,'0'),'99999')  from all_tab_columns a , all_col_comments b  where a.table_name = b.table_name and a.column_name = b.column_name  and a.Table_Name=upper('{tName}')  and a.owner = upper('{own}') order by  a.column_id

msyql

select case when table_schema is null then '' else table_schema end,case when TABLE_NAME is null then '' else TABLE_NAME end,case when upper(column_name) is null then '' else lower(column_name) end,case when COLUMN_COMMENT is null then '' else REPLACE(REPLACE(COLUMN_COMMENT, CHAR(10), '\\u200b'), CHAR(13),'\\u200c') end,case when ordinal_position is null then '' else ordinal_position end ,case when DATA_TYPE is null then '' else DATA_TYPE end,case when NUMERIC_PRECISION is null then '' else NUMERIC_PRECISION end,case when NUMERIC_SCALE is null then '' else NUMERIC_SCALE end from information_schema.columns  where table_name=upper('{tName}')  and table_schema = upper('{own}') order by  ordinal_position

达梦

select case when a.owner is null then '' else a.owner end,case when a.table_name is null then '' else a.table_name end,case when a.column_name is null then '' else lower(a.column_name) end,case when b.COMMENTS is null then '' else REPLACE(REPLACE(b.COMMENTS, CHAR(10), '\\u200b'), CHAR(13),'\\u200c') end,to_char(column_id,'99999'),case when a.DATA_TYPE is null then '' else a.DATA_TYPE end,to_char(NVL(DATA_LENGTH,'0'),'99999'),to_char(NVL(a.DATA_PRECISION,'0'),'99999'),to_char(NVL(a.DATA_SCALE,'0'),'99999')  from all_tab_columns a , all_col_comments b  where a.table_name = b.table_name and a.column_name = b.column_name  and a.Table_Name=upper('{tName}')  and a.owner = upper('{own}') order by  a.column_id
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值