Keep SQLtest alive: Help cover this month's $100 server costs to keep all lessons and the SQL playground online. Support the project →
SQL code copied to buffer
Task 122:

Find airports relations

PostgreSQL
For each airport, find a list of destination and departure airports.
Create the resulting table with the columns: airport_code - airport code, departures_to - array of destination airport codes and  arrivals_from - array of departure airport codes. Sort both arrays in alphabetical order. Sort the result by the first column.
Expected result Columns: 3 · Rows: 104
airport_code departures_to arrivals_from

Sample rows open after wrong checks: 0 of 2

Write your query below and click "Check it!". Tables are described in the right pane.

The query result will appear here. Ctrl+Enter - Run query