您的位置:首页 > 数据库 > Oracle

gbase,hive,teradata,db2,oracle数据库查询字段信息,类型,注释的sql语句.

2016-08-15 09:03 1086 查看
之前整理了常用的5种数据库查询字段的sql语句

在这里分享给大家:

**********************************************************************

hive 

查询字段信息语句 : desc 数据库名.表名

                        //解析字段名

返回值解析:              result.getString("col_name");

                        //解析出字段类型

                        result.getString("data_type")

                        //解析注释

                        result.getString("comment")

**********************************************************************

db2

sql语句: select tabname, t.colname,t.typename,t.remarks from syscat.columns t  where tabname='表名'

remarks=注释

***********************************************************************

TD

sql语句;select ColumnName,ColumnType,TableName,CommentString  from columns where tablename='表名'

************************************************************************

oracle

SELECT b.column_name column_name --字段名

      ,b.data_type data_type     --字段类型

      ,b.table_name              --所属表

      ,a.comments comments       --字段注释

FROM user_col_comments a

    ,all_tab_columns b

WHERE a.table_name = b.table_name and

      a.table_name = '表名';

************************************************************************

gbase

select column_name,column_comment,data_type from information_schema.columns where table_name='表名' and table_schema='数据库名'

*************************************************************************
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息