Mysql--一条SQL语句多条插入、更新、删除

● 插入

INSERT INTO users(name, age) VALUES('姚明', 25), ('比尔.盖茨', 50), ('火星人', 600);

● 更新

UPDATE member SET descipt = "默认" WHERE usertypeid IN (1,2,3,4);
UPDATE member
 SET descipt = CASE id
 WHEN 1 THEN '默认'
 WHEN 2 THEN '黄铜'
 WHEN 3 THEN '黄金'
 END
 WHERE id IN (1,2,3);

● 删除

DELETE FROM users WHERE id IN (1,2,3,4);

你可能感兴趣的:(MySQL数据库)