Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2007
    Posts
    23

    Unanswered: 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 !

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    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
    Home | Blog

  3. #3
    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 "

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Umayer, thank you for your contribution, it is a good guess.
    But this question is one that yanqinghuang has to understand for themselves
    George
    Home | Blog

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    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 ..

  7. #7
    Join Date
    Apr 2007
    Location
    Chicago
    Posts
    68
    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)

  8. #8
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •