Salesforce Interview Question

Given some tables and output requirements give the corresponding sql statements.