UPDATE salary
SET sex = CHAR ( ASCII(sex) ^ ASCII( 'm' ) ^ ASCII( 'f' ) );
^ 是异或操作。
‘f’ ^ (‘m’ ^ ‘f’) = ‘m’ ^ (‘f’ ^ ‘f’) = ‘m’
‘m’ ^ (‘m’ ^ ‘f’) = ‘f’ ^ (‘m’ ^ ‘m’) = ‘f’
UPDATE salary
SET sex = CHAR ( ASCII(sex) ^ ASCII( 'm' ) ^ ASCII( 'f' ) );
^ 是异或操作。
‘f’ ^ (‘m’ ^ ‘f’) = ‘m’ ^ (‘f’ ^ ‘f’) = ‘m’
‘m’ ^ (‘m’ ^ ‘f’) = ‘f’ ^ (‘m’ ^ ‘m’) = ‘f’