1、Oracle里面批量修改某种格式的数据
本文转自 tianya23 51CTO博客,原文链接:http://blog.51cto.com/tianya23/271148,如需转载请自行联系原作者
eg:将表abc里面name字段里的内容增加'12'
update abc set name= name || '12';
2、MySql
Mysql中的拼接常用concat函数来完成; 在Mysql中,同样可以使用字符串拼接的方法来完成。
为表abc的name字段都的内容都加上‘123’
update abc
set
name=concat(
name,
'123');
3、Mysql中查看特定位置的数据
(1)查询最前面一定数量的数据, 通过limit
select *
from abc limit 10;
(2)查询表中最后的一定量的数据, 通过查询表中最大的来完成:
select max(id) from table
select *
from subscription
where
id > (
select
max
(id)
from
subscription)-10
and
id < (
select
max
(id)
from
subscription);
4、批量修改部分数据
将id大于600万的数据的status内容修改为‘DISABLED’状态
update subscription
set status =
'ENABLED'
where id > 6000000;
将subscription_detail表中status为‘CANCEL’的数据的前600万的状态修改为‘PAUSE’状态 (status为‘CANCEL’的数据量为1200万)。
update subscription_detail
set status =
'PAUSE'
where status =
'CANCEL' limit 6000000;