Trianz interview question

programming in c,sql query