在oracle中,可用“num_rows”和“user_tables”來查詢表的行數(shù),“num_rows”列一小時更新一次,語法為“select table_name,num_rows from user_tables where 條件”。
本教程操作環(huán)境:Windows10系統(tǒng)、Oracle 11g版、Dell G3電腦。
oracle怎么查詢表的行數(shù)
語法為:
select table_name,num_rows from user_tables
在user_tables后面可以添加符合自己的條件,當然如果你有dba權(quán)限的話,可以將user_tables換成dba_tables,
num_rows列并不是事實更新的,查新之前最好先ANALYZE下 analyze table 這里寫表名compute statistics;
DBA權(quán)限下可以查詢dba_tables,里面有個num_rows列
select table_name,num_rows from dba_tables where ...;
條件可以根據(jù)自己需要來加
num_rows列并不是實時更新的,1小時更新一次。
推薦教程:《Oracle視頻教程》