计数没有。来自多个表的记录; Oracle数据库 [英] Counting no. of records from multiple tables; Oracle DB

查看:109
本文介绍了计数没有。来自多个表的记录; Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我需要使用这个查询来获取模式表的列表:
select table_name from all_tables where owner ='schema'

I know i need to use this query to get the list of tables for a schema: select table_name from all_tables where owner='schema'

我知道以下查询计算表中的记录:
select count(*)from schema.table

I know the following query counts the record in a table: select count(*) from schema.table

该模式中有2400个表。
我的问题是如何使用一个步骤计算所有表中的记录数。

There are 2400+ tables in that schema. My question is how to count the number of records from all the tables using one step?

推荐答案

code> ALL_TABLES 包含 NUM_ROWS 列。 (您可以使用以下SQL语句获取表的描述: DESCRIBE ALL_TABLES;

The table ALL_TABLES contains the column NUM_ROWS. (You can get a description of the table with the following SQL statement: DESCRIBE ALL_TABLES;)

显示每个表的记录数:

SELECT TABLE_NAME, NUM_ROWS FROM ALL_TABLES WHERE OWNER='SCHEMA';

要获取模式的所有表中的记录数,请使用:

To get the number of records in all tables of your schema, use:

SELECT SUM(NUM_ROWS) FROM ALL_TABLES WHERE OWNER='SCHEMA';

这篇关于计数没有。来自多个表的记录; Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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