Finoit interview question

Some puzzles from internet and SQL queries.