MAQ Software Interview Question

Sql query