MTK
MTK

Reputation: 3580

Mysql SELECT unicode characters

I have two tables:

words table:

+----+-------+------+
| id | word  | lang |
+----+-------+------+
|  1 | uña   | es   |
|  2 | two   | en   |
|  3 | three | en   |
|  4 | four  | en   |
+----+-------+------+

stop_words table:

+----+------+------+
| id | word | lang |
+----+------+------+
|  1 | una  | es   |
|  2 | one  | en   |
+----+------+------+

I need to select a word from words table where the word are not in stop_words table

I use utf8mb4_unicode_ci for database, tables and columns.

Any idea how to solve this?

Upvotes: 0

Views: 672

Answers (1)

AnouarZ
AnouarZ

Reputation: 1107

SELECT id, word, lang 
FROM words 
WHERE BINARY word NOT IN (Select BINARY word FROM stop_words);

Result :

+----+-------+------+
| id | word  | lang |
+----+-------+------+
|  1 | uña   | es   |
|  2 | two   | en   |
|  3 | three | en   |
|  4 | four  | en   |
+----+-------+------+

using utf8_unicode_ci for tables

EDIT : For the same case

SELECT  id, word, lang 
FROM words 
WHERE BINARY LOWER(word) NOT IN (Select BINARY LOWER(word) FROM stop_words);

Upvotes: 1

Related Questions