mysql sql CRUD

 

    remove alias problem

delete from aaa where id in (select id from bbb)   对

delete from aaa a where exist(select id from bbb where id=a.id)  错

delete a from aaa a where exist(select id from bbb where id=a.id)  对

 

    Two tables update multiple fields

update student a,student2 b
set a.class_name=b.class_name,
a.name=b.name,
a.age=b.age
where a.id=b.id

 

XOR function

select BIT_XOR(is_valid) from student
group by sname --is_valid The same is 0, the difference is 1

 

Guess you like

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