The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Why UNION instead of CROSS JOIN?

Why UNION instead of CROSS JOIN?

0
Votes
1
Answer

In what circumstances will you use UNION over CROSS JOIN and vice versa?

1 Answer

365 Team
0
Votes

Hi Adolfo!
 
Great to have you in the course and thanks for reaching out!
 
These represent two very different functionalities provided by MySQL
 
UNION is used whenever you want to simply combine data vertically. This means that UNION shall be used whenever you have two tables or two sets of data that share identical fields, so that the first set can be, so to speak, extended by the data from the second set.
 
CROSS JOIN is about matching all records from the designated tables. This type of join is also used whenever you are in the stage of making analysis and would simply like to exploit the number of possible combinations.
 
I am sure going through these videos once more and completing all provided exercises will make you a more confident user of both structures.
 
Hope this helps.
Best,
365 Team