Copeland interview question

How to get the following output using SQL commands