這個問題,在以前就有寫過,可是想找到語句仍是記不得,這裏主要說起我本身有用到的數據庫mysql和oraclemysql
一、mysqlsql
這個是本身安裝的,全部配置都是默認配置沒有改變,因此保存表名的表仍是information_schema.tables,語句以下:數據庫
--獲取數據庫中全部用戶名,表名 select table_schema 用戶名,table_name 表名 from information_schema.tables --獲取'test'用戶下全部表 select table_schema 用戶名,table_name 表名 from information_schema.tables where table_schema='test' --判斷'test'用戶下是否有'user'表 select * from information_schema.tables where table_schema='test' and table_name='user' --在mysql裏面表名、用戶名能夠不區分大小寫,譬以下面語句也能夠查詢出結果 select * from information_schema.tables where table_schema='TEST' and table_name='uSer'
二、Oracleoracle
這個不是個人數據庫,而oralce中保存表名的表在網上也是衆說紛紜,我最終找到的表是all_tables,並且它保存的表名做爲字符串是區分大小寫的spa
--取某個表 select * from all_tables WHERE upper(OWNER) LIKE '用戶名大寫' AND upper(TABLE_NAME) LIKE '表名大寫' --取庫中全部表 select * from all_tables select * from all_tables@想要的遠程庫