获取数据库表结构
MYSQL
select ORDINAL_POSITION COLUMN_ID, COLUMN_NAME, COLUMN_TYPE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH DATA_LENGTH, IS_NULLABLE NULLABLE, COLUMN_DEFAULT,
COLUMN_COMMENT COMMENTS, COLUMN_KEY, EXTRA from INFORMATION_SCHEMA.COLUMNS where table_name ='role'
oracle
select t.COLUMN_NAME ,t.DATA_TYPE ,t.DATA_LENGTH ,c.COMMENTS ,t.NULLABLE ,t.COLUMN_ID
from all_tab_columns t inner join all_col_comments c on t.table_name = c.table_name and t.COLUMN_NAME = c.COLUMN_NAME where t.TABLE_NAME ='FILES'
GROUP BY t.column_id,t.COLUMN_NAME,t.DATA_TYPE,t.DATA_LENGTH,t.NULLABLE,c.comments ORDER BY t.column_id
select table_name from user_tables; //当前用户的表
select table_name from all_tables; //所有用户的表
select table_name from dba_tables; //包括系统表
其中user_开头的是获取当前用户的表,all_开头的是所有用户的表,dba_开头的是包括系统表的