SQL Language (MOSC)

MOSC Banner

Understand Query

edited Sep 8, 2016 5:00AM in SQL Language (MOSC) 3 commentsAnswered
Hello   

  I need to understand why those queries doesn't send the same result :

-- TAB2 contains rows with ref_id_tab1 null

   select count(*)

  FROM TAB1

  where id  not in  ( select ref_id_tab1

                  FROM TAB2  
                  where ref_id_tab1  is not null);

  COUNT(*)

----------

     5

select count(*)

  FROM TAB1

  where id  not in  ( select ref_id_tab1

                  FROM TAB2 
                  where ref_id_tab1);

 

   COUNT(*)

----------

    

0

Regards

Djm

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center