Rain
Rain

Reputation: 319

Should I name the username field in my user table "name" or "username"?

If I name it username then I would have to write user_username when referring to my field when I can just write user_name if it's named "name". On the other hand, username sounds more appropriate than name.

Can someone help me make a decision?

Upvotes: 2

Views: 1231

Answers (4)

derdo
derdo

Reputation: 1036

Another possible option is login

Upvotes: 0

milanseitler
milanseitler

Reputation: 765

But you can also try nickname.

Upvotes: 0

Rob Agar
Rob Agar

Reputation: 12469

username, it's more specific and won't get mixed up with proper human names.

Here's a tip: while you're there, it's a good idea to decide on the proper name columns early - first_name and last_name or surname and given_name or whatever. It doesn't really matter, but it's a right pain when tables are inconsistent.

Upvotes: 0

Mark Byers
Mark Byers

Reputation: 839114

You should call it username.

The field name (or user_name if you are prefixing all fields with the table name) is ambiguous because it might be their real name, which is usually different from their username.

Upvotes: 4

Related Questions