Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL DB selects records with and without umlauts. e.g: '.. where something = FÖÖ'

My Table collation is "utf8_general_ci". If i run a query like:

SELECT * FROM mytable WHERE myfield = "FÖÖ"

i get results where:

...  myfield = "FÖÖ"
...  myfield = "FOO"

is this the default for "utf8_general_ci"?

What collation should i use to only get records where myfield = "FÖÖ"?

like image 466
Benjamin Grieshaber Avatar asked Jun 08 '11 13:06

Benjamin Grieshaber


People also ask

How do I exclude something in MySQL?

To check records which are NULL, use IS NULL. However, to exclude any of the records, use the NOT IN clause. Use both of them in the same query.

When we deal with database what purpose we use select command?

SELECT is used to retrieve rows selected from one or more tables, and can include UNION operations and subqueries.

What is clause in MySQL?

The MySQL WHERE Clause The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified condition.


1 Answers

SELECT * FROM table WHERE some_field LIKE ('%ö%'  COLLATE utf8_bin)
like image 133
Gunni Avatar answered Sep 17 '22 17:09

Gunni