2

Are Table names in a Query supposed to be Case-SensitIvE in MySQL?

For example, if I do the following:

var query = "SELECT something FROM thAt WHERE this = '". $everything ."'";

If the actual table name is all lowercase, and I use a combination of upper and lowercase in my select query, SHOULD it match? Is table names in queries supposed to be case-(in)sensitive?

Michael Petrotta
  • 58,479
  • 27
  • 141
  • 176
βӔḺṪẶⱫŌŔ
  • 1,256
  • 3
  • 17
  • 33
  • possible duplicate of [Is SQL syntax case sensitive?](http://stackoverflow.com/questions/153944/is-sql-syntax-case-sensitive) – Daniel Pryden Apr 10 '11 at 04:32

2 Answers2

8

From < Is SQL syntax case sensitive? >:

Mysql has a configuration option to enable/disable it. Usually case-sensitive table and column names are the default on Linux MySql and case-insensitive used to be the default on Windows, but now the installer asked about this during setup. For MSSQL it is a function of the database's collation setting.

Here is the MySql page about name case-sensitivity: http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

Here is the article in MSDN about collations for MSSQL: http://msdn.microsoft.com/en-us/library/ms143503(SQL.90).aspx

Community
  • 1
  • 1
Mark Cidade
  • 96,194
  • 31
  • 221
  • 232
3

As per the documentation here, case sensitivity of table names is filesystem-dependent. On Windows, they are case insensitive.

kqnr
  • 3,568
  • 17
  • 15