Aptean interview question

SQL was more difficult then I thought