runtime
133 / 139

task Missing relationships / anti-joins · medium

Routes flown in one direction only

Find routes whose reverse (destination → origin) does not exist in routes. Return origin and destination.

what to return

Columns
origindestination in this order
Rows
46 rows · any order
Skill
Find relationships that are not symmetric. Refresher: Self-joins & referral relationships →

expected result

expected result46 rows · any order
origindestination
AUSCHS
AUSSJU
BNABUF

first 3 of 46 rows

data you can query

routes4 columns · 5,436 rows
route_idnumber · unique idorigintext · links to airportsdestinationtext · links to airportsdistance_milesnumber
1ABECLT481
2ABEFLL1041
3ABEMCO906
4ABEMLB914
5ABEMYR518
6ABEPGD1018
7ABEPIE970
8ABESFB882
9ABESRQ1000
10ABIDFW158
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
route_idnumber · unique id
7
origintext · links to airports
ABE
destinationtext · links to airports
PIE
distance_milesnumber
970
route_idnumber · unique id
8
origintext · links to airports
ABE
destinationtext · links to airports
SFB
distance_milesnumber
882
route_idnumber · unique id
9
origintext · links to airports
ABE
destinationtext · links to airports
SRQ
distance_milesnumber
1000
route_idnumber · unique id
10
origintext · links to airports
ABI
destinationtext · links to airports
DFW
distance_milesnumber
158

first 10 of 5,436 rows · your queries use all of them

solution.sql
 
Output

Hints and the answer are always available. Using them counts the question as solved with help.

Routes flown in one direction only — SQL practice · Runtime