Clairvoyant Interview Question

Group by sql queries