some用法
最近更新时间: 2025-02-18 16:02:00
drop table if exists t_some_dml_20220718_1;
create table t_some_dml_20220718_1(v int, w int);
insert into t_some_dml_20220718_1 values(1, 1);
insert into t_some_dml_20220718_1 values(2, 2);
update t_some_dml_20220718_1 set w = 3 where w > some(0, 1);
delete t_some_dml_20220718_1 where w > some(0, 1);
insert into t_some_dml_20220718_1 values(1, 1);
insert into t_some_dml_20220718_1 select 2, 2 from t_some_dml_20220718_1 where w <> some(0, 1);
with cte_some_update as (select v from t_some_dml_20220718_1 where v > some(0, 1)) update t_some_dml_20220718_1 set w = (select v from cte_some_update order by v limit 1) where w > all(0, 1);
select * from t_some_dml_20220718_1 order by v;
with cte_some_delete as (select v from t_some_dml_20220718_1 where v > some(0, 1)) delete t_some_dml_20220718_1 where w = some(select v from cte_some_delete order by v limit 1);
select * from t_some_dml_20220718_1 order by v;
insert into t_some_dml_20220718_1 values(1, 1);
with cte_some_insert as (select v, w from t_some_dml_20220718_1 where v > some(0, 1)) insert into t_some_dml_20220718_1 select v, w from cte_some_insert;
select * from t_some_dml_20220718_1 order by v;