Oracle(三)常用的查詢語句

 

ORACLE下的三個視圖

 

  1. DBA_TABLES  擁有DBA角色的用戶可以查看系統中的所有表

  2. USER_TABLES 登錄數據庫的當前用戶擁有的所有表

  3. ALL_TABLES 登錄數據庫的當前用戶有權限查看的所有表

     簡單應用

        select table_name from user_tables; //當前用戶擁有所有表的表名(查詢當前用戶)

        select table_name from all_tables; //所有用戶的表的表名

         select table_name from dba_tables; //所有表的表名包括系統表

        select table_name from dba_tables where owner='用戶名'//某dba用戶所有表的表名(查詢別的用戶)

其他應用

 

select * from all_tab_comments -- 查詢所有用戶的表,視圖等。

select * from user_tab_comments -- 查詢本用戶的表,視圖等。

select * from all_col_comments  --查詢所有用戶的表的列名和註釋。

select * from user_col_comments -- 查詢本用戶的表的列名和註釋。

select * from all_tab_columns --查詢所有用戶的表的列名等信息。

select * from user_tab_columns --查詢本用戶的表的列名等信息。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章