Visa Inc. interview question

How to query from table given