Wiley interview question

Write a sql table and a query