Uber Interview Question

Sql, not a trivial one