Can I safely rely on column name case in mysql?

北城余情 提交于 2019-12-01 20:56:00

Short answer is no.

The long answer is that case-sensitivity for some things in MySQL depend on the underlying operating system. (Unix being the sensitive one)

Here is the reference to the issue in the MySQL documentation.

Consequently, the case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names. This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. One notable exception is Mac OS X, which is Unix-based but uses a default file system type (HFS+) that is not case sensitive.

Also from the documentation on column names specifically:

Column, index, and stored routine names are not case sensitive on any platform, nor are column aliases. Trigger names are case sensitive, which differs from standard SQL.

MySQL is case sensitive in table and column names, and case in-sensitive in keywords.

But note that Windows is only case preserving, and file names are table names. (If you work on table "SalesAccounts" when you meant "Salesaccounts" then it will read OK on Windows and fail on Linux.

You should be OK with what you want to do, but 1) Test on Linux, 2) Test the tools you are using.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!