This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

uncleared on query result while applying left outer join

upanshu vaid
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranch,
I am getting the following result while running the following query
select E.Lname As Employee_name,
S.Lname As Supervisor_name
from (EMPLOYEE As E left outer join EMPLOYEE As S
ON E.Super_ssn=S.Ssn)

Employee_name Supervisor_name
Smith Smith
Wong Wong
English English
Narayan Narayan
Borg Borg
Wallace Wallace
Jabbar Jabbar
Zelaya NULL

As per me result should be

Employee_name Supervisor_name
Smith Wong
Wong Borg
English Wong
Narayan Wong
Wallace Borg
Jabbar Wallace
Zelaya Wallace

Employee table i am using

Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno
John B Smith 123456789 1965-01-09 731 Fondren,Houston,TX M 30000.00 123456789 5
Franklin T Wong 333445555 1955-12-08 638 Voss,Houston,TX M 40000.00 333445555 5
Joyce A English 453453453 1972-07-31 5631 Rice,Houston,TX F 25000.00 453453453 5
Ramesh K Narayan 666884444 1962-09-15 975 Fire Oak,Humble,TX M 38000.00 666884444 5
James E Borg 888665555 1937-11-10 450 Stone,Houston,TX M 55000.00 888665555 1
Jennifer S Wallace 987654321 1941-06-20 291 Berry,Bellaire,TX F 43000.00 987654321 4
Ahmad V Jabbar 987987987 1969-03-29 980 Dallas,Huston,TX M 25000.00 987987987 4
Alicia J Zelaya 999887777 1968-01-19 3321 Castle,Spring,TX F 25000.00 NULL 4

kindly help on understanding the result of this .Fname

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic