0

I am facing one confusion in FULL OUTER JOIN .

My question is how to achieve FULL OUTER JOIN in MySQL either use UNION or UNION ALL ?

I have gone through several blogs and stackoverflow posts , but some programmers are saying that use UNION or Some are saying use UNION ALL

Please suggest me what is correct.

Thanks any help'd be appreciated.

Ketan G
  • 507
  • 1
  • 5
  • 21
  • UNION removes duplicate records (where all columns in the results are the same), UNION ALL does not. But you question is not very clear. What do you mean by FULL OUTER JOIN? Maybe you can [expand your question](http://stackoverflow.com/posts/39890203/edit) with some examples. UNION concatenates resulting rows. [Full outer join](http://www.w3schools.com/sql/sql_join_full.asp) means something else. – Rik Oct 06 '16 at 07:39
  • in FULL OUTER JOIN what i should use UNION or UNION ALL this is my question – Ketan G Oct 06 '16 at 07:42
  • It depends on if you want duplicate records. The UNION ALL will/can give you duplicate records. If you don't want them you can use UNION (but with a speed penalty because of the de-duplication). – Rik Oct 06 '16 at 07:43
  • both solutions will be correct ? – Ketan G Oct 06 '16 at 07:43
  • The UNION (ALL) stands apart from the FULL OUTER JOIN. So I don't know why you mentioned them together. But both UNION and UNION ALL will give the same result with the exception that UNION removes any duplicate rows (where all fields are the same). – Rik Oct 06 '16 at 07:45
  • http://stackoverflow.com/questions/49925/what-is-the-difference-between-union-and-union-all – Rik Oct 06 '16 at 07:45

0 Answers0