Jump to content

Is MySQL case sensitive?

- - - - -

  • Please log in to reply
5 replies to this topic

#1
yooj

yooj

    Newbie

  • Members
  • Pip
  • 1 posts
The title says it all. Is MySQL case sensitive? :cool:

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I believe it depends on the Operating System you have MySQL on. I could be wrong though:

Quote

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:

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

MySQL AB :: MySQL 5.0 Reference Manual :: 8.2.2 Identifier Case Sensitivity
[/B]

#3
shri_bill

shri_bill

    Newbie

  • Members
  • Pip
  • 2 posts
Hi,

I'm a Linux user, as we know Unix-based operating systems are strictly a case-sensitive. But even on Linux, mysql client's commands, SQL commands (in accordance with SQL standards) and function-names etc. are NOT case-sensitive, i.e. both 'select' and 'SELECT' are perfectly valid, however entity-names such as names of tables and databases are case-sensitive, i.e. if a table's name is 'Customer', we cannot use 'customer' or 'CUSTOMER'. Once again, remember: even though table-names are case-sensitive, column-names are not.

HTH
Aditya Shrivastava
Let's create a "suffering free world" BKWSU.com :).

Edited by shri_bill, 18 January 2011 - 02:47 AM.


#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
SQL itself isn't case sensitive, but it can be on searching data, all depends on the table collation settings.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#5
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts
No.
Programming is a journey, not a destination.

#6
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
MySQL syntax is not case sensitive, you can write
SELECT * FROM table WHERE ...
or
select * from table where...
or
SeLEct * FroM table WHerE
or whatever else you want.

On select queries you can search for case sensitive fields values, in example if you want to find "text" inside a field but not "TEXT", "Text".... you can use

SELECT * FROM table WHERE binary(fieldname)='text';




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users