How I can order the returned results by relevance in mysql or mariadb when I use like statement in where?

Dimitrios Desyllas - Apr 8 - - Dev Community

As I ask upon https://dba.stackexchange.com/q/338422/118215

I search in this table:

mytable:
---
id PK Biginteger Autoincrement
name varchar(255)
Enter fullscreen mode Exit fullscreen mode

Like this:

select * from mytable where name like "%someval%"; 
Enter fullscreen mode Exit fullscreen mode

And I want to sort my result using the closest match towards someval. How I can do this?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player