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 中的列名和表名是否区分大小写?


基础教程推荐
- SQL Server 2016更改对象所有者 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01