Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SELECT Table with maximum number of rows from one schema

IoriFeb 5 2008 — edited Feb 12 2008
Hello everyone,

I would like to find the table which contains the maximum number of rows in a
schema.

SELECT table_name, MaxRows
FROM (SELECT MAX (num_rows) MaxRows, table_name
FROM dba_tables
WHERE owner = 'MySchema' group by table_name order by MaxRows desc );

The above statement returns the entire list of tables.
Table_Name MaxRows
Table A 21000
Table B 12000
Table C 250

How can I get as result only one single table_name without the entire list of table and order by etc.?
Table_Name
Table A

Kind Regards,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 11 2008
Added on Feb 5 2008
5 comments
1,026 views