数据库
首页 > 数据库> > mysql句法

mysql句法

作者:互联网

mysql 句法:

目录

mysql 句法:

交换sex的内容(m -> f, f -> m)


交换sex的内容(m -> f, f -> m)

update salary set sex = (if(sex="m", "f", "m"));

update salary set sex = char(ascii('m') + ascii('f') - ascii(sex));

UPDATE salary SET sex = CASE sex WHEN 'm' THEN 'f' ELSE 'm' end;

update salary set sex = case sex when 'm' then 'f' when 'f' then 'm' end

标签:salary,set,update,sex,mysql,句法,ascii
来源: https://blog.csdn.net/satomiyo/article/details/90484268