Capgemini Interview Question

SQL & PostGre DB with query explanation