IFS interview question

Given some simple sql codes to write?