当前第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 server数据表压缩
sql语句中的ddl类型的数据库定义语言操作
mysql数据库必备之条件查询语句
mysql和sql是干什么的?
sql server 2005 数据库复制详细介绍
eclipse怎么与sql连接?
sqlserver2005 行列转换实现方法
mysql与sql的区别有哪些
防止web项目中的sql注入
ios sqlite对数据库的各种操作(日常整理全)
更多相关阅读请进入《sql》频道 >>
机械工业出版社
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
转载请注明出处:木庄网络博客 » sql怎么修改表内容