Jump to content

Case Sensitive


d_barszczak

Recommended Posts

MySQL is case [b]in[/b]sensitive, unless there is a configuration option I'm unaware of.

[tt]select * from table where name like 'david%'[/tt] should give you what you want, including dAvidA, DAVIDb, daviDc, etc.

[tt]select * from table where name like binary 'david%'[/tt] should keep 'david' lowercase, resulting in davidA, davidB, davidc, etc.
Link to comment
Share on other sites

Ok here is the table in question.

[code]
+-------+-------------+-----------+------+-----+---------+-------+----------------------+---------+
| Field | Type        | Collation | Null | Key | Default | Extra | Privileges          | Comment |
+-------+-------------+-----------+------+-----+---------+-------+----------------------+---------+
| name  | varchar(40) | ascii_bin | YES  |    |        |      | select,insert,update |        |
| age  | int(11)    |          | YES  |    |        |      | select,insert,update |        |
| sex  | varchar(1)  | ascii_bin | YES  |    |        |      | select,insert,update |        |
+-------+-------------+-----------+------+-----+---------+-------+----------------------+---------+

[/code]
Link to comment
Share on other sites

Well, those look like binary collations, meaning they're case sensitive -- that's not the default, so your DB must have a different character set?  You can either change the collation on the table, or simply collate as part of your query.
Link to comment
Share on other sites

ahh so thats my problem.

I have always used an web hosting company to manage my mysql server but this is my test server that i have at home.

I changed it to ascii_bin as i think the default was something like latin_sweedish or something.

So it's the collation.

Shortly after i made the post i realised that i have used case-insensitive queries before.

Thank you for your help
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.