mysql:
1.查詢數據庫中所有表名稱:
select table_name from information_schema.tables where table_schema='數據庫名稱';(包含視圖)
select table_name from information_schema.tables where table_schema='數據庫名稱' and table_type = 'BASE TABLE' AND table_schema = DATABASE ();(不包含視圖)
2.查詢每張表中所有字段名:
select COLUMN_NAME from INFORMATION_SCHEMA.Columns where table_name='表名稱' and table_schema='數據庫名稱';
oracle:
1.查詢數據庫中所有表名稱:
select t.table_name from user_tables t;
2.查詢每張表中所有字段名:
SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = '表名稱';