Syntax in mysql statement

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324435884&siteId=291194637