Avatar of gram77
gram77Flag for India

asked on 

Intersect Vs. Join query showing different results.

I have two tables table_a and table_b.

If i do a intersect query. it shows me say 100 records matched.
However, if i do a join it shows me 0 rows matched.

How is this possible. Since intersect and a join are the same thing?


select count(*)
from
(select table_a.col1,
      table_a.col2,
      table_a.col3,
      table_a.col4,
      table_a.col5
from table_a
INTERSECT
select table_b.col1,
      table_b.col2,
      table_b.col3,
      table_b.col4,
      table_b.col5
from table_b);
*******************
rows returned: 100
*******************


select table_a.*, table_b.*
from table_a, table_b
where table_a.col1 = table_b.col1
and  table_a.col2 = table_b.col2
and  table_a.col3 = table_b.col3
and  table_a.col4 = table_b.col4
and  table_a.col5 = table_b.col5

*******************
rows returned: 0
*******************
Oracle Database

Avatar of undefined
Last Comment
gram77
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of gram77
gram77
Flag of India image

ASKER

angelll:
ic, thx a lot
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo