Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 给出表(c1)中的一系列数字,找出缺失的数字_Sql_Postgresql_Gaps And Islands - Fatal编程技术网

Sql 给出表(c1)中的一系列数字,找出缺失的数字

Sql 给出表(c1)中的一系列数字,找出缺失的数字,sql,postgresql,gaps-and-islands,Sql,Postgresql,Gaps And Islands,给出表C1中的一系列数字,找出缺失的数字。数字应该是连续的 c1 -- 1 2 3 6 7 8 9 12 14 Expected output: i - 4 5 10 11 13 使用以下系列: 使用以下系列: 面试问题?作业左键将表连接到生成的序列并查找NullsInService问题?作业将表左键联接到生成的序列并查找空值 select s.i from (select generate_series(min(c1), max(c2), 1) as i from t

给出表C1中的一系列数字,找出缺失的数字。数字应该是连续的

c1
--
1
2
3
6
7
8
9
12
14

Expected output:
i
-
4
5
10
11
13
使用以下系列:

使用以下系列:


面试问题?作业左键将表连接到生成的序列并查找NullsInService问题?作业将表左键联接到生成的序列并查找空值
select s.i
from (select generate_series(min(c1), max(c2), 1) as i
      from t
     ) s left join
     t
     on s.i = t.c1
where t.c1 is null;