일부 ID가 겹치는 두 테이블을 작성하십시오.이상한 DB2 범위
create table outer_table (
id integer,
overlap_in smallint default 0
);
create table inner_table (
inner_id integer
);
다음으로 몇 가지 공통점이있는 ID로 채우십시오.
insert into outer_table(id) values 0, 1, 2, 3, 4, 5, 6, 7, 8, 9;
insert into inner_table(inner_id) values 0, 1, 2;
다음으로 중첩 표시기를 업데이트하십시오. 실수로 잘못된 열 이름을 입력하면 "inner_id"대신 "id"라고 쓰고 별칭을 사용하지 않기로 결정했습니다.
update outer_table o
set o.overlap_in = 1
where o.id in (select id from inner_table);
결과 : 그것은 outer_table
의 모든 행에 overlap_in 필드에 1을 업데이트
- 없음 SQL 오류? db2가 이것을 허용하는 이유는 무엇입니까?
주 : DB2 버전 :
>db2level DB21085I Instance "....." uses "64" bits and DB2 code release "SQL09075" with level identifier "08060107". Informational tokens are "DB2 v9.7.0.5", "...", "IP23285", and Fix Pack "5".