Tech Mahindra interview question

about SQL and some queries/scripts