在Oracle中标识具有最大行数的表 [英] Identify a table with maximum rows in Oracle

查看:145
本文介绍了在Oracle中标识具有最大行数的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Oracle中有一组表,我想确定包含最大行数的表.

I have a set of tables in Oracle and I would like to identify the table that contains the maximum number of rows.

因此,如果我希望能够识别表B,那么A有200行,B有345行,C有120行.

So if, A has 200 rows, B has 345 rows and C has 120 rows I want to be able to identify table B.

是否可以运行一个简单的查询来实现这一目标?

Is there a simple query I can run to achieve this?

有100多个表,所以我正在寻找通用的东西.

There are 100 + tables so I am looking for something generic.

推荐答案

鉴于您说您正在使用Oracle,我只会查询元数据.

Given that you said you were using Oracle I would just query the meta-data.

select table_name, max(num_rows) from all_tables where table_name in ('A', 'B', 'C');

刚刚看到了您的修改.只需运行不带where子句的上述内容,它将返回数据库中最大的表.唯一的问题可能是您可能会得到SYS $表或其他内容.或者,如果您只是为了自己的知识而这样做,

Just saw your edit. Just run the above without the where clause and it will return the largest table in the database. Only problem may be that you might get a SYS$ table or something. Alternately if you are just doing this for your own knowledge just do

select table_name, num_rows from all_tables order by num_rows; 

您将看到最大的东西.

这篇关于在Oracle中标识具有最大行数的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆