Sign up username

How do you make sure that users are unable to choose a username that already exists in your db?