🎯 Few days left this month Support SQLTest.online and help us keep SQL practice free for everyone. Donate today →
SQL code copied to buffer
Task

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.

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