IFS Interview Question

Given some simple sql codes to write?