CGI interview question

also given an sql query