-----对于普通表 实现: UPDATE T_PM_DEPOSIT_HIS b SET flag = SUBSTR( flag, 1, 8 )||'4'|| CASE WHEN term <= 365 THEN '1' ELSE '2' END AS flag WHERE b.data_date>=20130101 DECLARE CURSOR cur IS SELECT b.ROWID ROW_ID FROM T_PM_DEPOSIT_HIS b where b.data_date>…
一.构造相关表P1,P2 create table p1(id int,name char(10)); create table p2(id int,name char(10)); 二.批量插入数据 begin for i in 1 .. 100000 loop insert into p1 values(i,'a'||i); end loop ; commit; end; begin for i in 1 .. 100000 loop insert into p2 values(i,'b'||…
一.单表查询 1.完整的语法顺序(可以不写完整,其次顺序要对) (不分组,且当前表使用聚合函数: 当前表为一组,显示统计结果 ) select distinct [*,查询字段1,查询字段2,表达式, 聚合函数..] from 表名 ##############distinct 去重, 与查询字段一个级别 where 分组之前的过滤条件 group by 分组依据 ##############可以分多次 例如 group by age,sex 每个年龄阶段的男女 having 分组之后的过滤条件…
SQL> create table test1(id int,name char(10)); Table created. begin for i in 1 .. 1000000 loop insert into test1 values(i,'a'||i); end loop; commit; end; SQL> set timing on SQL> update test1 set id=9999 where id >100; 999900 rows updated. Elap…
SQLSERVER:通过sys.tables实现批量删表,或者回滚表 begin try drop table #temp10 end try begin catch end catch select 'drop/*truncate*/ table dbo.'+name as droptable,ROW_NUMBER() over(order by name) as rownumber into #temp10 from sys.tables where name like 'member%'…
已知 child parent a b a c d b d c b e b f c g c h x g x h m x m n o x o n 则 c 2+c+g 2+c+h 1+a+c 1+d+c h 1+c+h 1+x+h d 2+d+b 2+d+c b 1+a+b 1+d+b 2+b+e 2+b+f o 2+o+x 2+o+n e 1+b+e m 2+m+x 2+m+n x 2+x+g 2+x+h 1+m+x 1+o+x a 2+a+c 2+a+b 也即 gc[0] = a gc[1]=d…