Autosoft interview question

Some simple data algorithm and SQL