首页 > 编程知识 正文

mysql数据库取中文列名,怎么在mysql中添加中文列名

时间:2023-12-24 13:45:39 阅读:321894 作者:ZVIM

本文目录一览:

mysql怎么把字段名变成中文

1、创建测试表,

create table test_zw(id number, v_date date);

2、插入测试数据

insert into test_zw values(1,20190101);

insert into test_zw values(2,20190102);

insert into test_zw values(3,20190103);

insert into test_zw values(4,20190104);

3、查询表中记录,select t.* from test_zw t;

4、编写sql,将v_date字段翻译为中文'日期',select t.*, V_DATE AS '日期' from test_zw t;

MySQL中表的列名是不是不能用中文

最好不要使用中文,原因如下:

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

打字老是切换中英文,这个速度上也会变慢了好多比如 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;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。