SQL nested query (not exists) -
i have table called train, has columns number, arrive_station, depart_station
i have populated , find trains serve edinburgh (i.e., trains departing station arrive edinburgh) use nested query , use not exists operator.
so far have tried..
select depart_station train arrive_station = "edinburgh" , not exists ( select arrive_station train arrive_station != "edinburgh" );
you need relate nested query outer query somehow if number train number you'd want add aliases tables , add and t1.number = t2.number
.
select depart_station train t1 arrive_station = "edinburgh" , not exists ( select arrive_station train t2 t2.arrive_station != "edinburgh" , t1.number = t2.number );
Comments
Post a Comment