LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Improving Query Performance in SQL Server

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

SELECT CountryName 
FROM ___ -- Table from Earthquakes database

___ -- Operator for the intersect between tables

SELECT Country
FROM ___; -- Table from NBA Season 2017-2018 database
Code bearbeiten und ausführen