ZS Associates Interview Question

Based on My Sql queries.