FAQ: Multiple Tables - Union

This community-built FAQ covers the “Union” exercise from the lesson “Multiple Tables”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Data Science

Learn SQL

FAQs on the exercise Union

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

About the condition with the same amount of columns in the tables: what if we only choose 2 columns per table to union but the original tables don’t have the same amount of columns, will it work?
let’s say the table newspaper has 5 columns and the table subscription has 3. if i only pick 2 per table for the union is that possible?
select id, first_name
from newspaper
select id, start_month
from subscription;


Can someone please clarify for me the following: Are all of the queries in this exercise just that “queries” or do some actually change the tables, columns or data? Such as cross join or union, etc…

About the rules-

  • Tables must have the same number of columns.
  • The columns must have the same data types in the same order as the first table.

Both tables must also have the same column names?

1 Like

What if you want to ‘Union’ multiple tables, considering all tables meet requirements, do you have to type the ‘union’ title of each table?

This might be a stupid question but why is it that when we JOIN two tables it is sufficient to simply SELECT * to display the resultant joined table, like so:

FROM table1
INNER JOIN table 2

However for a union, the method changes such that we have to specify SELECT * twice, like this:

FROM table1
FROM table2

If SELECT can be used to display the resultant joined table, why can it be used similarly like so:

FROM table1
UNION table2

This would follow the syntax that we use in JOIN.


What is the difference between Union and Cross Join? They both look the same to me but they were introduced as different things so I know they are not supposed to be the same.