M
M
Maxim Tyulpakov2017-04-26 18:27:03
MySQL
Maxim Tyulpakov, 2017-04-26 18:27:03

Is it possible to organize a search at the beginning of each phrase?

In one cell Surname Name Patronymic. With the help of like, you need to make a selection at the beginning of typing each phrase (word). If you do only at the beginning of the line, then it will not be possible to find a person by name .. But if you type "I", - the output is both "surname" and "first name" - that there is garbage in the search ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2017-04-26
@MaXComp

Store full name in this format: [X] Last name [X] First name [X] Patronymic , where [X] is some special. character, such as a space. Well, or any other, the main thing is to avoid conflicts with this symbol so that it does not participate in the formation of the text of the full name itself.
This will allow you to do LIKE '[X]'+'substring' - which will work on the beginning of the first name, last name or patronymic (substring - search substring).
PS Perhaps it is worth looking in the direction of normalization and splitting the full name - it all depends on how the entity is perceived in the system. If this is not an atomic value in the concept of your system, if you need to store large volumes of full name with a history of change, for example, then here First Name, Last Name and Patronymic are separate properties of the entity.

K
Konstantin Tsvetkov, 2017-04-26
@tsklab

In one cell Last name First name Middle name
Divide into three fields.
And read: habrahabr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question