mysql怎么把字段名变成中文

mysql怎么把字段名变成中文,第1张

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

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

mysql数据库两表关联列能为中文,不要加双引号。但最好不要用中文,除了兼容性不好外,还有就是会出现一些莫名其妙的问题,如使用中文的列的表用多表查询的内连接的自然连接时就实现不了该效果,而用英文的话就正常。


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

原文地址:https://54852.com/zaji/7339289.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存