TD interview question

Database question