X interview question

Write a sql query for the table defined.