BASF interview question

gave a senario SQL question