mysql命名约定 [英] mysql naming convention

查看:64
本文介绍了mysql命名约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常总是在表中使用某种Hungarian Notation作为我的字段名称,例如

I have generally always used some sort of Hungarian Notation for my field names in my tables e.g.

#Table Users
u_id, u_name, u_email etc...

#Posts
p_id, p_u_id, p_title, p_content etc...

但是最近我被告知这不是最佳实践.有没有更标准的方式来做到这一点?我不是很喜欢仅使用字段id,因为这需要您选择table.field,以便使用联接等时出现在多张表中的字段名称.

But I have recently been told that this isn't best practice. Is there a more standard way of doing this? I haven't really liked just using the field id as this is then requirs you to select table.field for fields names that appear in mutliple tables when using joins etc.

您对最佳实践的想法将不胜感激.

Your thoughts on what is best practice would be appreciated.

推荐答案

最佳实践是您或您的团队最舒适的选择.每个程序员对于使用符号都有自己的看法.

The best practice is the most comfortable for you or your team. Every programmer has it's own opinion about using notations.

这篇关于mysql命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆