Allowing only 1 user to have a nickname

Hey guys how do I go about making a nickname allowed to only be used once in the database so say someone had the nickname Jerry and someone wanted to update their nickname to the same thing they wouldn’t be able to if there is already a Jerry in the database?