Home > Database > Oracle > How to query user's table information in Oracle

How to query user's table information in Oracle

WBOY
Release: 2022-02-28 11:24:33
Original
9858 people have browsed it

How to query user table information in oracle: 1. Use "SELECT count(*) FROM user_tables" to query the number of tables under the current user; 2. Use "SELECT * FROM user_tables;" to query the tables under the current user .

How to query user's table information in Oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How oracle queries user’s table information

-- View the current user’s table:

SELECT count(*) FROM user_tables;   -- 查看当前用户下有多少张表
SELECT * FROM user_tables;          -- 查看当前用户下的表
SELECT * FROM user_tab_comments;        -- 查看当前用户下的表,注释等
SELECT * FROM user_col_comments;    -- 查看当前用户下的表的列名和注释
SELECT * FROM user_tab_columns;     -- 查看当前用户下的表的列名等信息(详细但是没有备注)
SELECT t.TABLE_NAME, t.NUM_ROWS FROM user_tables t;   -- 查看当前用户下的所有表名及该表含多少数据
Copy after login

-- View all users’ tables:

SELECT * FROM all_tab_comments;     -- 查看所有用户的表,注释等
SELECT * FROM all_col_comments;     -- 查看所有用户的表的列名和注释
SELECT * FROM all_tab_columns;      -- 查看所有用户的表的列名等信息(详细但是没有备注)
Copy after login

- - Query template 1:

SELECT t.table_name, t.comments FROM user_tab_comments t;
Copy after login

-- Query template 2:

SELECT r1, r2, r3, r5 
    FROM
    ( SELECT a.table_name r1, a.column_name r2, a.comments r3 FROM user_col_comments a ),
    ( SELECT t.table_name r4, t.comments r5 FROM user_tab_comments t ) 
    WHERE r4 = r1;
Copy after login

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to query user's table information in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template