查詢數據庫中所有表名,查詢表中所有字段名


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 = '表名稱';


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM