Quantcast interview question

IP validator SQL involving ranking function