1. alter table table1 add second_value integer; update table1 set second_value=value*10; commit;2.select a.id from 某表 a,某表 b where a.id=b.id+1 and a.value>b.value;
对的,default值里不能关联其他字段
--1 alter table table1 add second_value integer default value*10; --2 select t1.* from table_name t1,table_name b where t1.id+1=t2.id and t1.value>t2.value;
1、ALTER TABLE TABLE1 ADD SECOND_VALUE INTEGER; UPDATE TABLE1 SET SECOND_VALUE=VALUE*10; 2、SELECT A.ID FROM 某表 A,某表 B WHERE A.ID=B.ID+1 AND A.VALUE>B.VALUE; 还想说的是,这种可以通过运算得到的字段,根本就没有必要加
select id from (select id, value, lead(value) as lvalue over(order by id) from table) where lvalue > value
select id from (select id, value, lead(value) over(order by id) as lvalue from table) where lvalue > value
update table1 set second_value=value*10;
commit;2.select a.id from 某表 a,某表 b where a.id=b.id+1 and a.value>b.value;
--1
alter table table1 add second_value integer default value*10;
--2
select t1.* from table_name t1,table_name b where t1.id+1=t2.id and t1.value>t2.value;
UPDATE TABLE1 SET SECOND_VALUE=VALUE*10;
2、SELECT A.ID FROM 某表 A,某表 B WHERE A.ID=B.ID+1 AND A.VALUE>B.VALUE;
还想说的是,这种可以通过运算得到的字段,根本就没有必要加
from (select id, value, lead(value) as lvalue over(order by id) from table)
where lvalue > value
from (select id, value, lead(value) over(order by id) as lvalue from table)
where lvalue > value