PayU Interview Question

Queries on joins, swap adjacent query