If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > question about correct answer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-07, 03:39
yanqinghuang yanqinghuang is offline
Registered User
 
Join Date: Oct 2007
Posts: 23
question about correct answer

Given the two following tables:
names
name number
Wayne Gretzky 99
Jaromir Jagr 68
Bobby Orr 4
Bobby Hull 23
Brett Hull 16
Mario Lemieux 66
Steve Yzerman 19
Claude Lemieux 19
Mark Messier 11
Mats Sundin 13

Points
Name points
Wayne Gretzky 244
Jaromir Jagr 168
Bobby Orr 129
Bobby Hull 93
Brett Hull 121
Mario Lemieux 189
Joe Sakic 94
Which of the following statements will display the player's Names, numbers and points for all players with an entry in both tables?
(Select the correct response)
A. SELECT names.names, names.number, points.points FROM names INNER JOIN points ON names.name=points.name
B. SELECT names.name, names.number, points.points FROM names FULL OUTER JOIN points ON names.name=points.name
C. SELECT names.name, names.number, points.points FROM names LEFT OUTER JOIN points ON names.name=points.name
D. SELECT names.name, names.number, points.points FROM names RIGHT OUTER JOIN points ON names.name=points.name
I understand the different between full outer join and inner join.But this question "all players with an entry in both tables",i think it mean use full outer join. Also some said use inner join. Who is right?
Thanks !
Reply With Quote
  #2 (permalink)  
Old 11-15-07, 04:07
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Homework questions, eh?
This question is to test your knowledge of the differences between the different types of join.

Why don'y you start by expaining to us what you think is meant by
  • FULL OUTER JOIN
  • INNER JOIN
And then we'll proceed from there
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 11-15-07, 04:08
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
I think, "inner join" is the correct answer.

"an entry in both table" means, an entry in table name AND an entry in table points.

For a "full outer join" the wording should be: "... an entry in at least one table "
Reply With Quote
  #4 (permalink)  
Old 11-15-07, 04:12
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Umayer, thank you for your contribution, it is a good guess.
But this question is one that yanqinghuang has to understand for themselves
__________________
George
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 11-15-07, 07:36
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by yanqinghuang
I understand the different between full outer join and inner join.But this question "all players with an entry in both tables",i think it mean use full outer join. Also some said use inner join. Who is right?
Thanks !
both are correct

it is not an SQL issue, but rather, it is an issue of understanding the question

depending on how you interpret the question, both INNER JOIN and FULL OUTER JOIN satisfy the criteria of a player with an entry in both tables
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 11-15-07, 08:17
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Quote:
Originally Posted by r937
both INNER JOIN and FULL OUTER JOIN satisfy the criteria of a player with an entry in both tables
and a LEFT OUTER JOIN and A RIGHT OUTER JOIN satisfy them, too ..
Reply With Quote
  #7 (permalink)  
Old 11-15-07, 08:53
jsharon1248 jsharon1248 is offline
Registered User
 
Join Date: Apr 2007
Location: Chicago
Posts: 57
Your instructor needs to check his facts. Bobby Hull wore number 9 on his sweater. (Wikipedia shows that he wore 16 and 7 early in his career, but 9 is the number that the BlackHawks retired)
Reply With Quote
  #8 (permalink)  
Old 11-15-07, 10:33
yanqinghuang yanqinghuang is offline
Registered User
 
Join Date: Oct 2007
Posts: 23
Quote:
Originally Posted by umayer
I think, "inner join" is the correct answer.

"an entry in both table" means, an entry in table name AND an entry in table points.

For a "full outer join" the wording should be: "... an entry in at least one table "
Thanks , i am not clear what "an entry in both table" means at first. Now i understand the question. Thanks for your help!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On