Amazon Interview | SQL Interview Problem asked during Amazon Interview