728x90 반응형 -모든 컬럼에 대한 row(행) 개수 구하기
-특정 컬럼에 대한 row(행) 개수 구하기
-특정 컬럼의 중복값을 제외한 row(행) 개수 구하기
728x90 반응형 저작자표시 'Dev_Tip > Oracle_Tip' 카테고리의 다른 글
PREV 1 ··· 68 69 70 71 72 73 74 75 76 ··· 92 NEXT 2019. 7. 7. 12:36 728x90 반응형 WHERE 조건문에서 ROWNUM을 사용하여 원하는 개수만 조회할 수 있다 주의할점 : =이 아니고 <= 기호를 사용해야 한다 N개의 행만 조회하기 SELECT * FROM 테이블이름 WHERE ROWNUM <= N Example WARNING_LOG 테이블의 데이터 조회 사진 WARNING_LOG 테이블의 2개의 행만 조회하는 사진 728x90 반응형 저작자표시 'DB > Oracle' 카테고리의 다른 글
Modify | Delete NAME PASSWORD HOMEPAGE SECRET
+ Recent posts
Powered by Tistory, Designed by wallel Rss Feed and Twitter, Facebook, Youtube, Google+ According to the documentation NUM_ROWS is the "Number of rows in the table", so I can see how this might be confusing. There, however, is a major difference between these two methods. This query selects the number of rows in MY_TABLE from a system view. This is data that Oracle has previously collected and stored.
This query counts the current number of rows in MY_TABLE
By definition they are difference pieces of data. There are two additional pieces of information you need about NUM_ROWS.
If your table is never updated then it is certainly possible to use ALL_TABLES.NUM_ROWS to find out the number of rows in a table. However, and it's a big however, if any process inserts or deletes rows from your table it will be at best a good approximation and depending on whether your database gathers statistics automatically could be horribly wrong. Generally speaking, it is always better to actually count the number of rows in the table rather then relying on the system tables. |