LTM Limited interview question

code using map and filter, sql queries