SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Full outer join error - example for SimplySQL

    In the Sitepoint book 'SimplySQL' we are asked to create two tables consisting of nothing but 1 column of numbers and are then asked to run the query:

    Code:
    SELECT 
      a,b 
    FROM 
      A FULL OUTER JOIN B
        ON a=b
    ;
    This is causing the error:

    "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OUTER JOIN B
    ON a=b' at line 4"

    Changing the "full" outer join to "left" brings a result. Please can someone explain to me what I'm missing, I've tried reading the MySQL documentation and googling for an explanation but I'm at a loss.

    P.S. First time in a forum so please give me any necessary feedback regarding etiquette, etc.

  2. #2
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My apologies, the book clears this up in a later chapter.

    "an unfortunate error happens in at least one common database system. In MySQL, which doesn't support FULL OUTER JOIN despite it being standard SQL, the result is a syntax error...

    If your database system does not support the FULL OUTER JOIN syntax, the same results can be obtained by a slightly more complex query called a union."

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by thewebologist View Post
    P.S. First time in a forum so please give me any necessary feedback regarding etiquette, etc.
    you did great

    in hindisght i might have mentioned the mysql whoopsie at the first opportunity, eh
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Member
    Join Date
    Sep 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, was a bit nervous about posting.

    I'm loving the book, as someone who knew nothing of SQL before reading, it's approachable and explains the complexities extremely well. I'm excited by the possibilities.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    thanks for the kind words

    a lot of work went into simplifying down those complexities
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Tags for this Thread

Bookmarks

Posting Permissions

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