3

Hi all new to database outer join and inner join modified below code from

FROM leaf_star_stem_bud, leaf_star_item, cosmic_tank 
WHERE leaf_star_stem_bud.power_company_key  =  '6aa5' 
      And leaf_star_item.parent_key = 'eaab1' 
      And cosmic_tank.master_key = leaf_star_item.cost_code_key 
      And leaf_star_stem_bud.parent_key  =*  leaf_star_item.master_key  

to

FROM leaf_star_stem_bud 
    RIGHT OUTER JOIN leaf_star_item ON 
     leaf_star_stem_bud.parent_key = leaf_star_item.master_key , cosmic_tank 
WHERE leaf_star_stem_bud.power_company_key  =  '6aa5' 
       And leaf_star_item.parent_key = 'eaab1'
       And cosmic_tank.master_key = leaf_star_item.cost_code_key

but the query is not getting the same results could you please help me out

sameh.q
  • 1,671
  • 2
  • 23
  • 46

1 Answers1

1

INNER JOIN or JOIN or , :

  • Give me all leaf_star_stem_bud which has a leaf_star_item associated to it.

RIGHT JOIN or RIGHT OUTER JOIN:

  • Give me all leaf_star_stem_bud which has a leaf_star_item associated to it.
  • If there are more leaf_star_item, give me them and complete leaf_star_stem_bud info with null.

LEFT JOIN or LEFT OUTER JOIN:

  • Give me all leaf_star_stem_bud which has a leaf_star_item associated to it.
  • If there are more leaf_star_stem_bud, give me them and complete leaf_star_item info with null.

For more information:

What is the difference between Left, Right, Outer and Inner Joins?

http://en.wikipedia.org/wiki/Join_(SQL)

Community
  • 1
  • 1
Fabio Farath
  • 479
  • 6
  • 12