当前第2页 返回上一页
1 2 3 4 5 | update test1 set age='23' where id in ('1','2');
update test1 set age='22' where id between '3' and '4';
update test1 set age='23' where id>='5' and id <='6';
update top(2) test1 set age='23' where id>='5';
update test1 set age='23' where test1.id in (select top(2) id from test1 order by id desc);
|
示例结果:
多表关联修改表中数据
语法:update 表1 set 表1.列1=值,表1.列2=值 from 表1 as a,表2 as b where a.列名=b.列名;
示例:
1 | update test1 set test1.name='李华',test1.sex='女' from test1 as a,test2 as b where a.classid=b.id;
|
示例结果:
总结:修改数据表数据,灵活组合修改数据列,数据源,查询条件是关键。
以上就是sql怎么修改表内容的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
python实现sql注入检测插件实例代码
如何得到数据库中所有表名 表字段及字段中文描述
sql优化老出错,那是你没弄明白mysql解释计划用法
sqlserver 模糊查询常用方法
数据库备份与恢复方案
“select 1 from table”什么意思
sql指的是什么
sql中like的用法
解决mybatis中mapper.xml文件update,delete及insert返回值问题
关于mysql基础知识的介绍
更多相关阅读请进入《sql》频道 >>
机械工业出版社
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
转载请注明出处:木庄网络博客 » sql怎么修改表内容