Home > Database > Oracle > How to query the total number of tables in Oracle

How to query the total number of tables in Oracle

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2022-05-10 16:56:03
Original
23329 people have browsed it

In Oracle, you can use the SELECT statement to query the total number of tables. This statement is used to select data from the database. When used in conjunction with COUNT(), you can query the number of tables under the user. The syntax is " SELECT COUNT(1) FROM USER_TABLES;".

How to query the total number of tables in Oracle

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

How to query the total number of tables in oracle

Query the number of tables under the user

SELECT COUNT(1) FROM USER_TABLES;
Copy after login

Query the number of fields in the tables under the user

SELECT COUNT(1)
  FROM USER_COL_COMMENTS C
 WHERE EXISTS
 (SELECT 1 FROM USER_TABLES T WHERE T.TABLE_NAME = C.TABLE_NAME);
Copy after login

Number of query table records

SELECT T.TABLE_NAME, T.NUM_ROWS, T.BLOCKS, T.EMPTY_BLOCKS
  FROM USER_TABLES T;
Copy after login

Query table remarks

SELECT TABLE_NAME, TABLE_TYPE, COMMENTS
  FROM USER_TAB_COMMENTS
 WHERE COMMENTS LIKE '%字典%'
Copy after login

Space occupied by query table

analyze table T_DATA compute statistics;
 
SELECT NUM_ROWS , AVG_ROW_LEN
  FROM USER_TABLES
 WHERE TABLE_NAME = 'T_DATA';
 
SELECT SEGMENT_NAME, SUM(BYTES) / 1024 / 1024
  FROM USER_EXTENTS
 GROUP BY SEGMENT_NAME;
Copy after login

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to query the total number of tables 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