Update set

单表操作

update tstudents t set t.age = 18 where t.name = 'TOM'

多表操作

where条件操作

update tstudents t set t.school_id = 01 where exists(select 1 from tschools a where a.school_name = 'Alice')

被修改值是从其他表查询得到

update tstudents t set t.school_id = (select a.school_id from tschools a where a.school_name = 'Alice') where t.name = 'TOM'

被修改值超过两个值

update tstudents t set (t.school_id, t.school_name)= (select a.school_id, a.school_name from tschools a where a.school_founder = 'Alice') where t.name = 'TOM'
posted @ 2018-03-23 22:30  Sti  阅读(272)  评论(0编辑  收藏  举报