BNP Paribas interview question

some sql questions, some comptency based