American Express Interview Question

Sql query on joins , big query