S
S
Soft_touch_plastic2020-11-06 13:58:20
SQL
Soft_touch_plastic, 2020-11-06 13:58:20

How to configure sql query to be case sensitive?

A query such as "SELECT * FROM user WHERE name='dima'" will also return results where name is equal to Dima, dima, etc. How to implement strict validation?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitsliputsli, 2020-11-06
@Soft_touch_plastic

SELECT * FROM user WHERE name='dima'

SELECT * FROM user WHERE binary name='дима'
And specify the DBMS you are working with, your question is specific to MySQL.

V
Vladimir Korotenko, 2020-11-06
@firedragon

Case sensitive look for your base. Diacritics and national standards are also important

I
idShura, 2020-11-06
@idShura

In order not to write binary in the query as Vitsliputsli suggested , you can make a binary Collation (for example, utf8_bin or utf8mb4_bin) for the desired column. And add information about the DB, encoding, etc. to the question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question