Regarding the if syntax in the sql statement:
select
if(
name='lisi',
'1',
'2'
) AS name_x
from
student
Indicates that when the value of the field name in the student table is 'lisi', the value of name_x is 1, otherwise it is 2
Regarding the if syntax in the sql statement:
select
if(
name='lisi',
'1',
'2'
) AS name_x
from
student
Indicates that when the value of the field name in the student table is 'lisi', the value of name_x is 1, otherwise it is 2