Mysql
下面是mysql獲取數據庫所有表的語句
select table_name from information_schema.TABLES where TABLE_SCHEMA='Username' information_schema這個是數據系統用來保存數據表的總表
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables where table_schema = (select database())
拿到表之后,可以獲取表的所有字段。 select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns where table_name = 'tablename' and table_schema = (select database()) order by ordinal_position
Oracle
獲取用戶所有表
select table_name from user_tables where TABLESPACE_NAME is not null and user='UserName'
獲取表字段 SELECT table_name, column_name, data_type FROM all_tab_cols WHERE table_name = 'tablename '