Fourth Signal interview question

I was asked about 4-5 SQL Queries