Orpak interview question

SQL queries, check if a number is a prime number, find errors in two functions.