Ali Express Interview Question

Based on a table, write the solution using SQL