I've recently stumbled into an interesting Mysql query:
Which is the max value of a bigint unsigned. What does the tilde operator do in this case?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
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.