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:
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.
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."
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.