开发者

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

开发者 https://www.devze.com 2023-02-17 12:23 出处:网络
If I name it username then I would have to write user_username wh开发者_运维知识库en referring to my field when I can just write user_name if it\'s named \"name\".On the other hand, username sounds mo

If I name it username then I would have to write user_username wh开发者_运维知识库en 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?


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.


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.


But you can also try nickname.


Another possible option is login

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号