IBM interview question

Coding question in C++ and one SQL query