Clairvoyant interview question

Group by sql queries