当前第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怎么修改表内容的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
sql中insert如何批量插入多条记录?
mysql数据库必备之条件查询语句
c#实现过滤sql特殊字符的方法集合
sqlserver按顺序执行多个脚本的方法(sqlcmd实用工具使用方法)
怎么将sql文件导入navicat
大数据分析r语言rstudio使用超详细教程
8种主流nosql数据库系统特性对比和最佳应用场景
sql数据库日志已满解决方法
sql server数据库按百分比查询出表中的记录数
sql表连接图解
更多相关阅读请进入《sql》频道 >>
机械工业出版社
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
转载请注明出处:木庄网络博客 » sql怎么修改表内容