0
테이블 bill
의 열 이름이 인 bill_id입니다. bill_id
값 범위는 1 내지 40이고, I는 I 누락 요소를 찾는 방법SQL을 사용하여 일련의 누락 요소를 찾는 방법은 무엇입니까?
bill_id
-----------
1
3
6
8
2
21
34
35
26
40
같은 행이 (4, 5, 7, 9, 10, 등)?
테이블 bill
의 열 이름이 인 bill_id입니다. bill_id
값 범위는 1 내지 40이고, I는 I 누락 요소를 찾는 방법SQL을 사용하여 일련의 누락 요소를 찾는 방법은 무엇입니까?
bill_id
-----------
1
3
6
8
2
21
34
35
26
40
같은 행이 (4, 5, 7, 9, 10, 등)?
SQL> create table bill (bill_id)
2 as
3 select 1 from dual union all
4 select 3 from dual union all
5 select 6 from dual union all
6 select 8 from dual union all
7 select 2 from dual union all
8 select 21 from dual union all
9 select 34 from dual union all
10 select 35 from dual union all
11 select 26 from dual union all
12 select 40 from dual
13/
Table created.
SQL> with all_possible_bill_ids as
2 (select level bill_id
3 from dual
4 connect by level <= 40
5 )
6 select bill_id
7 from all_possible_bill_ids
8 minus
9 select bill_id
10 from bill
11/
BILL_ID
----------
4
5
7
9
10
11
12
13
14
15
16
17
18
19
20
22
23
24
25
27
28
29
30
31
32
33
36
37
38
39
30 rows selected.
감사합니다,
롭.