数据库表名,列名用中文有什么利弊

数据库表名,列名用中文有什么利弊,第1张

弊远远大于利。

数据库的原始设计(以及所有的编程语言),都是基于英文,中文如果遇上乱码的问题,反正会很难处理。

打字老是切换中英文,这个速度上也会变慢了好多比如

select

学生名字

from

学生表格

where

学生年龄>10

中英文切换来切换去,实在是太麻烦了。

至于利,反正我看不到。除了说能一眼看到这个表名用上了中文,某些人会有莫名其秒的成就感,除此之后,我也想不出别的什么了。

1、创建测试表,create table test_student(stu_id number, class_id number)

2、插入测试数据,

insert into test_student values(1,1001)

insert into test_student values(2,1001)

insert into test_student values(3,1002)

insert into test_student values(4,1003)

insert into test_student values(5,1003)

insert into test_student values(6,1003)

commit

3、查询数据表中内容,select * from test_student

4、将列名翻译为中文名进行展示,select stu_id as "学生编码", class_id as "课程编码" from test_student t

首先,不建议用中文名,除非无论任何除非时候都能保证统一的字符集。我建议你可以用这个拼音码做列名,这样也让你的表好让人明白一点,另外你的中文列名可以生成描述,做为备注用,也不用在用什么总表记录中文列名,多麻烦啊。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/6770174.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-28
下一篇2023-03-28

发表评论

登录后才能评论

评论列表(0条)

    保存