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!

Strange behaviour of IN, MINUS and COUNT?

797687Oct 14 2010 — edited Oct 14 2010
Hello Everyone,

DB: 10g.

Problem: I have two tables - A and B. Both have ID as column which is a primary key of the tables. A and B got records from table C.
SQL> SELECT COUNT(*) FROM A;
816234
SQL> SELECT COUNT(ID) FROM A;
816234

SQL> SELECT COUNT(*) FROM B;
750878
SQL> SELECT COUNT(ID) FROM B;
750878

SQL> SELECT 816234 - 750878 FROM dual;
65356

SQL>select count(id) from A where id not in (select id from B);
65690 Why not 65356?

SQL>select id from A minus select id from B;
65960 rows. How come?
Please advice.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 11 2010
Added on Oct 14 2010
11 comments
768 views