Are column and table name case sensitive in MySQL?(MySQL 中的列名和表名是否区分大小写?)
问题描述
如果我有一个名为 category_id 和 Category_Id 的列名,它们是否不同?
If I have a column names called category_id and Category_Id, are they different?
如果我有名为 category 和 Category 的表,它们是否不同?
And if I have table called category and Category, are they different?
推荐答案
在 Unix 上,表名区分大小写.在 Windows 上,它们不是.有趣,不是吗?有点像他们各自的文件系统.你认为这是巧合吗?
On Unix, table names are case sensitive. On Windows, they are not. Fun, isn't it? Kinda like their respective file systems. Do you think it's a coincidence?
换句话说,如果您计划在 Linux 机器上部署,最好也针对基于 Linux 的 MySQL 测试您的 SQL,或者在生产时为神秘的找不到表"错误做好准备.现在虚拟机很便宜.
In other words, if you are planning on deploying on a Linux machine, better test your SQL against a Linux-based MySQL too, or be prepared for mysterious "table not found" errors at prod time. VMs are cheap these days.
字段(列)名称不区分大小写.
Field (column) names are case-insensitive regardless.
我们讨论的是 MySQL 服务器 机器上的操作系统,而不是客户端.
we're talking about the operating system on the MySQL server machine, not client.
这篇关于MySQL 中的列名和表名是否区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 中的列名和表名是否区分大小写?
基础教程推荐
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
