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;".
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
Query the number of tables under the user
SELECT COUNT(1) FROM USER_TABLES;
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);
Number of query table records
SELECT T.TABLE_NAME, T.NUM_ROWS, T.BLOCKS, T.EMPTY_BLOCKS FROM USER_TABLES T;
Query table remarks
SELECT TABLE_NAME, TABLE_TYPE, COMMENTS FROM USER_TAB_COMMENTS WHERE COMMENTS LIKE '%字典%'
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;
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!