1. Learn
  2. /
  3. Courses
  4. /
  5. Improving Query Performance in SQL Server

Connected

Exercise

Interrogating with INTERSECT

INTERSECT and EXCEPT are very useful for data interrogation.

The Earthquakes and NBA Season 2017-2018 databases both contain information on countries and cities. You are interested to know which countries are represented by players in the 2017-2018 NBA season and you believe you can get the results you require by querying the relevant tables across these two databases.

Use the INTERSECT operator between queries, but be careful and think about the results. Although both tables contain a country name column to compare, these are separate databases and the data may be stored differently.

Instructions 1/2

undefined XP
    1
    2
  • INTERSECT CountryName from a table in the Earthquakes database and Country from a table in the NBA Season 2017-2018 database.