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 中的列名和表名是否区分大小写?
基础教程推荐
- 什么是 orradiag_<user>文件夹? 2022-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 在多列上分布任意行 2021-01-01
