What does SELECT ~0; do?
It selects the logical negation of 0 and returns it in the implicitly converted datatype.  Rather than selecting 8 bytes containing all 0's, it selects 8 bytes containing all 1's, returning the maximum possible unsigned value.