ComeçarComece de graça

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.

Este exercício faz parte do curso

Improving Query Performance in SQL Server

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

SELECT CountryName 
FROM ___ -- Table from Earthquakes database

___ -- Operator for the intersect between tables

SELECT Country
FROM ___; -- Table from NBA Season 2017-2018 database
Editar e executar o código