# mysql
select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra, CHARACTER_MAXIMUM_LENGTH charLength,column_type columnType from information_schema.columns
where table_name = 'nota_ncode' and table_schema = (select database()) order by ordinal_position
image.png
# oracle
select
A.column_name 字段名,A.data_type 数据类型,A.data_length 长度,A.data_precision 整数位,
A.Data_Scale 小数位,A.nullable 允许空值,A.Data_default 缺省值,B.comments 备注,
C.IndexCount 索引次数
from
user_tab_columns A,
user_col_comments B,
(select count(*) IndexCount,Column_Name from User_Ind_Columns where Table_Name = '这里是大写表名' group by Column_Name) C
where
A.Table_Name = B.Table_Name
and A.Column_Name = B.Column_Name
and A.Column_Name = C.Column_Name(+)
and A.Table_Name = '这里是大写表名';
image.png
# oracle查询当前用户的表名、表注释
select t.table_name tableName, f.comments comments
from user_tables t
inner join user_tab_comments f
on t.table_name = f.table_name
参考:
https://www.cnblogs.com/xqf222/archive/2010/08/29/3306799.html
https://blog.csdn.net/qq_39997939/article/details/122414748
https://www.php.cn/oracle/489383.html
网友评论