Logio interview question

SQL questions and How to code Factorial