BJIT interview question

python basic + sql query