what does the following query mean in mysql?
select user from mysql.user where user=''!=(mid((user)from(-1))='t')
do you know what's the meaning of mid((user)from(-1)
? it's very strange for me. user is the name of one of the tables in mysql
CodePudding user response:
As stated in the documentation, the MySQL MID()
function is a synonym for the SUBSTRING()
function. The SUBSTRING()
function can be called in different ways (see documentation), among them in the form
SUBSTRING(str FROM pos)
This means "extract the substring from the string str
, starting at the position pos
".
The documentation also states:
It is also possible to use a negative value for
pos
. In this case, the beginning of the substring ispos
characters from the end of the string, rather than the beginning.
So that means, mid((user)from(-1)
should give you the last character of the contents of user
.