ION Group Interview Question

DBMS, SQL queries and some puzzles