Domanda di colloquio di Amazon

basic sql questions such as what is cross join, outer join. sql question about flights. Given following variables, to get distinct route. Departure varchar ,Arrival varchar ,Price float ,purchase_date date ,fullfilment_date date

Risposta di colloquio

Anonimo

13 lug 2019

In my opinion, this depends on the definition of distinct route. if the route from A to B is different from B to A: select departure, arrival from flights group by departure, arrival; if the route from A to B is same as B to A: select distinct if(departure < arrival, concat(departure, "-", arrival), concat(arrival, "-", departure)) from flights;

2