C++博客-晓洛的茶园-随笔分类-数据库http://www.cppblog.com/diferent/category/14181.html犀利~各种犀利zh-cnSun, 04 Jul 2010 16:43:11 GMTSun, 04 Jul 2010 16:43:11 GMT60Mysql 查询列注释及列名称http://www.cppblog.com/diferent/archive/2010/07/05/119324.html晓洛晓洛Sun, 04 Jul 2010 16:32:00 GMThttp://www.cppblog.com/diferent/archive/2010/07/05/119324.htmlhttp://www.cppblog.com/diferent/comments/119324.htmlhttp://www.cppblog.com/diferent/archive/2010/07/05/119324.html#Feedback0http://www.cppblog.com/diferent/comments/commentRss/119324.htmlhttp://www.cppblog.com/diferent/services/trackbacks/119324.html
select  column_name, column_comment from information_schema.columns where table_schema ='databaseName'  and table_name = 'tableName';

//查询表注释及表名称
select table_name,table_comment from information_schema.tables  where table_schema = 'image' and table_name ='tableName';



晓洛 2010-07-05 00:32 发表评论
]]>
Oracle查询表注释http://www.cppblog.com/diferent/archive/2010/05/19/115806.html晓洛晓洛Wed, 19 May 2010 06:41:00 GMThttp://www.cppblog.com/diferent/archive/2010/05/19/115806.htmlhttp://www.cppblog.com/diferent/comments/115806.htmlhttp://www.cppblog.com/diferent/archive/2010/05/19/115806.html#Feedback0http://www.cppblog.com/diferent/comments/commentRss/115806.htmlhttp://www.cppblog.com/diferent/services/trackbacks/115806.html

字段注释

select   *   from   user_col_comments;

表注释

select   *   from   user_tab_comments;


//

查询字段类型

select column_name,data_type,data_length from user_tab_columns where table_name='TableName' and column_name in ('AGE_ID','MONTH_ID') 

Column_name值为大写


//

查询表的主键

select * from user_cons_columns where table_name='D_DAY'

//

select column_name from user_cons_columns where constraint_name in (select constraint_name from user_constraints where table_name = 'D_DAY' and constraint_type = 'P')


//查询某表字段的主键名称及类型

select column_name,data_type,data_length,DATA_PRECISION||','||DATA_SCALE from user_tab_columns v  join  (select column_name from user_cons_columns where constraint_name in (select constraint_name from user_constraints where table_name = 'D_DAY' and constraint_type = 'P')) t using (column_name) where table_name='D_DAY'



晓洛 2010-05-19 14:41 发表评论
]]>