Comparing global economies
Are you ready to perform your first set operation?
In this exercise, you have two tables, economies2015
and economies2019
, available to you under the tabs in the console. You'll perform a set operation to stack all records in these two tables on top of each other, excluding duplicates.
When drafting queries containing set operations, it is often helpful to write the queries on either side of the operation first, and then call the set operator. The instructions are ordered accordingly.
This exercise is part of the course
Joining Data in SQL
Exercise instructions
- Begin your query by selecting all fields from
economies2015
. - Create a second query that selects all fields from
economies2019
. - Perform a set operation to combine the two queries you just created, ensuring you do not return duplicates.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Select all fields from economies2015
___
-- Set operation
___
-- Select all fields from economies2019
___
ORDER BY code, year;