LoslegenKostenlos loslegen

Uncorrelated sub-query

A sub-query is another query within a query. The sub-query returns its results to an outer query to be processed.

You want a query that returns the region and countries that have experienced earthquakes centered at a depth of 400km or deeper. Your query will use the Earthquakes table in the sub-query, and Nations table in the outer query.

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 UNStatisticalRegion,
       CountryName 
FROM Nations
WHERE ___ -- Country code for outer query 
         IN (SELECT ___ -- Country code for sub-query
             FROM Earthquakes
             WHERE ___ >= ___ ) -- Depth filter
ORDER BY UNStatisticalRegion;
Code bearbeiten und ausführen