本文主要是介绍sql简单实现查询某个表字段名,是否主键,是否非空及备注信息,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
select Lower(column_name) "字段名",decode(data_type,'VARCHAR2',data_type||'('||data_length||')','NUMBER',data_type||'('||data_length||')') "字段编码", (select decode(column_name,c.COLUMN_NAME,'TRUE','FALSE')
from user_cons_columns cu, user_constraints au
where cu.constraint_name = au.constraint_name
and au.constraint_type = 'P' and au.table_name = c.table_name) "主要的",decode(nullable,'N','TRUE','Y','FALSE') "强制",(select comments from user_col_comments where table_name=c.TABLE_NAME and column_name = c.COLUMN_NAME ) "注释"
from user_tab_columns c where table_name = 'table_name ' order by column_id
这篇关于sql简单实现查询某个表字段名,是否主键,是否非空及备注信息的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!