task Missing relationships / anti-joins · medium
Routes flown in one direction only
Return origin and destination for routes whose reverse (destination → origin) does not exist in routes.
what to return
- Columns
origindestinationin this order- Rows
- 46 rows · any order
- Skill
- Find relationships that are not symmetric. Refresher: Self-joins & referral relationships →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result46 rows · any order
| origin | destination |
|---|---|
| AUS | CHS |
| AUS | SJU |
| BNA | BUF |
first 3 of 46 rows
data you can query
U.S. Flights dataset: the first 6 rows of each table. Under each column name: the kind of value it holds, and which table it links to. Your queries run on all rows.
routes4 columns · 5,436 rows
| route_idnumber · unique id | origintext · links to airports | destinationtext · links to airports | distance_milesnumber |
|---|---|---|---|
| 1 | ABE | CLT | 481 |
| 2 | ABE | FLL | 1041 |
| 3 | ABE | MCO | 906 |
| 4 | ABE | MLB | 914 |
| 5 | ABE | MYR | 518 |
| 6 | ABE | PGD | 1018 |
- route_idnumber · unique id
- 1
- origintext · links to airports
- ABE
- destinationtext · links to airports
- CLT
- distance_milesnumber
- 481
- route_idnumber · unique id
- 2
- origintext · links to airports
- ABE
- destinationtext · links to airports
- FLL
- distance_milesnumber
- 1041
- route_idnumber · unique id
- 3
- origintext · links to airports
- ABE
- destinationtext · links to airports
- MCO
- distance_milesnumber
- 906
- route_idnumber · unique id
- 4
- origintext · links to airports
- ABE
- destinationtext · links to airports
- MLB
- distance_milesnumber
- 914
- route_idnumber · unique id
- 5
- origintext · links to airports
- ABE
- destinationtext · links to airports
- MYR
- distance_milesnumber
- 518
- route_idnumber · unique id
- 6
- origintext · links to airports
- ABE
- destinationtext · links to airports
- PGD
- distance_milesnumber
- 1018
first 6 of 5,436 rows · your queries use all of them
solution.sql
Hints and the answer are always available. Using them counts the question as solved with help.