SimpliContract interview question

C programming and sql query