5

I can't find a reference about which part of a MySQL query is case sensitive.

Is there an overview of where capitalization matters?

Specifically, are any of these case sensitive:

  • database name
  • table name
  • column name

Is it tied to the OS? Configurable? Or some other combination of factors?

informatik01
  • 16,038
  • 10
  • 74
  • 104
Tyler DeWitt
  • 23,366
  • 38
  • 119
  • 196

2 Answers2

5

In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). 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.

.

The lower_case_table_names system variable also affects how the server handles identifier case sensitivity

You can read more about the topic here.

Nick Rolando
  • 25,879
  • 13
  • 79
  • 119
  • 1
    Which again proves that MySQL sucks. Why would you want to depend on the file system for the case-sensitivity of the table names? +1 for the answer, though. – GolezTrol Dec 05 '12 at 23:46
0

It depends on the collation. For example if your table has unicode_general_ci, it'll support general unicode character recognizing algorithm and it'll be case-*in*sensitive.

Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187
  • He is asking about case sensitivity of table and column names, not about the case sensitivity of the data in the tables (which indeed depends on collation). – Stijn de Witt Jun 14 '16 at 18:45