Razer Interview Question

How would you join / perform these queries