views:

200

answers:

4

If I have field names called category_id and Category_Id, are they different?

And if I have table name called category and Category, are they different?

A: 

No, table and row names are not case-sensitive, and even SQL statements aren't. So, the names you gave as example are identical
Edit: It depends on server collation. So you have to check the settings. Not related to OS.

alemjerus
Incorrect - Seva Alekseyev has it right.
David M
Sorry, I encountered this firsthand. Got the mental scars to prove.
Seva Alekseyev
+4  A: 

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?

Caveat: it probably depends on table type; 'twas MyISAM in my case.

Field names are case-insensitive regardless.

Seva Alekseyev
From MySQL documentation: Although database and table names are not case sensitive on some platforms, you should not refer to a given database or table using different cases within the same statement. The following statement would not work because it refers to a table both as my_table and as MY_TABLE: `SELECT * FROM my_table WHERE MY_TABLE.col=1;`, so quite correct, but should be treated as case sensitive in any case...
David M
It's not based on table type
OMG Ponies
+1  A: 

For database and table names, it depends on the underlying operating system. See 8.2.2. Identifier Case Sensitivity

Pekka
+1  A: 

You might find this necessary to read. It is possible to set the case sensitivity in MySQL but it really is only a problem when you work in multiple environments.

Vincent Ramdhanie
Yes, i used lower_case_table_names=1 on linux. It works, but only for tables you create after applying this setting.
Roland Bouman