Wiley Interview Question

Write a sql table and a query