Quantcast Interview Question

IP validator SQL involving ranking function