T3 Softwares interview question

on database part SQL query