GNU Info

Info Node: (mysql.info)Name case sensitivity

(mysql.info)Name case sensitivity


Next: Variables Prev: Legal names Up: Language Structure
Enter node , (file) or (file)node

Case Sensitivity in Names
-------------------------

In MySQL, databases and tables correspond to directories and files
within those directories.  Consequently, the case sensitivity of the
underlying operating system determines the case sensitivity of database
and table names.  This means database and table names are case
sensitive in Unix and case insensitive in Windows. Note: Extensions to
ANSI.

*NOTE:* Although database and table names are case insensitive for
Windows, you should not refer to a given database or table using
different cases within the same query.  The following query would not
work because it refers to a table both as `my_table' and as `MY_TABLE':

     mysql> SELECT * FROM my_table WHERE MY_TABLE.col=1;

Column names are case insensitive in all cases.

Aliases on tables are case sensitive.  The following query would not
work because it refers to the alias both as `a' and as `A':

     mysql> SELECT col_name FROM tbl_name AS a
                WHERE a.col_name = 1 OR A.col_name = 2;

Aliases on columns are case insensitive.

If you have a problem remembering the used cases for a table names,
adopt a consistent convention, such as always creating databases and
tables using lowercase names.

One way to avoid this problem is to start `mysqld' with `-O
lower_case_table_names=1'. By default this option is 1 on Windows and 0
on Unix.

If `lower_case_table_names' is 1 MySQL will convert all table names to
lower case on storage and lookup.  Note that if you change this option,
you need to first convert your old table names to lower case before
starting `mysqld'.


automatically generated by info2www version 1.2.2.9