ComenzarEmpieza gratis

Get all possible airports

The task of the next two exercises is to search for all possible flight routes. This means that, first, you have to find out all possible departure and destination airports from the table flightPlan.

In this exercise, you will create a CTE table named possible_Airports using the UNION syntax which will consist of all possible airports. One query of the UNION element selects the Departure airports and the second query selects the Arrival airports.

Este ejercicio forma parte del curso

Hierarchical and Recursive Queries in SQL Server

Ver curso

Instrucciones del ejercicio

  • Define the CTE table possible_Airports with the field Airports.
  • Select the airports by combining Departure and Arrival airports.
  • Combine the departure with the destination airports using the correct statement.
  • Select all possible Airports from possible_Airports.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

-- Definition of the CTE table
___ possible_Airports (___) ___(
  	-- Select the departure airports
  	SELECT ___
  	FROM flightPlan
  	-- Combine the two queries
  	___ 
  	-- Select the destination airports
  	SELECT ___
  	FROM flightPlan)

-- Get the airports from the CTE table
SELECT ___
FROM ___;
Editar y ejecutar código