📄 subquery2.out
字号:
I -----------1 ij> select i from s where i = -1 or i <> ANY (select i from t);I -----------0 1 ij> select i from s where i = 0 or i >= ANY (select i from t where i = -1);I -----------0 ij> select i from s where i = -1 or i < ANY (select i from t where i = -1 or i = 1);I -----------0 ij> select i from s where i = -1 or i >= ANY (select i from t);I -----------0 1 ij> select i from s where i = 0 or i > ANY (select i from t where i = -1);I -----------0 ij> select i from s where i = -1 or i <> ANY (select i from t where i = -1 or i = 1);I -----------0 ij> -- correlated subqueriesselect * from s where i > ANY (select i from t where s.s > t.s);I |S |C |VC |B -----------------------------------------------------------------------------------------------------1 |1 |1 |1 |1 ij> select * from s where i >= ANY (select i from t where s.s >= t.s);I |S |C |VC |B -----------------------------------------------------------------------------------------------------0 |0 |0 |0 |0 1 |1 |1 |1 |1 ij> select * from s where i < ANY (select i from t where s.s < t.s);I |S |C |VC |B -----------------------------------------------------------------------------------------------------0 |0 |0 |0 |0 1 |1 |1 |1 |1 ij> select * from s where i <= ANY (select i from t where s.s <= t.s);I |S |C |VC |B -----------------------------------------------------------------------------------------------------0 |0 |0 |0 |0 1 |1 |1 |1 |1 ij> select * from s where i = ANY (select i from t where s.s = t.s);I |S |C |VC |B -----------------------------------------------------------------------------------------------------0 |0 |0 |0 |0 1 |1 |1 |1 |1 ij> select * from s where i <> ANY (select i from t where s.s <> t.s);I |S |C |VC |B -----------------------------------------------------------------------------------------------------0 |0 |0 |0 |0 1 |1 |1 |1 |1 ij> -- ALL/NOT IN and NOTs-- create tablescreate table s_3rows (i int);0 rows inserted/updated/deletedij> create table t_1 (i int);0 rows inserted/updated/deletedij> create table u_null (i int);0 rows inserted/updated/deletedij> create table v_empty (i int);0 rows inserted/updated/deletedij> create table w_2 (i int);0 rows inserted/updated/deletedij> -- populate tablesinsert into s_3rows values(NULL);1 row inserted/updated/deletedij> insert into s_3rows values(1);1 row inserted/updated/deletedij> insert into s_3rows values(2);1 row inserted/updated/deletedij> insert into u_null values(NULL);1 row inserted/updated/deletedij> insert into t_1 values(1);1 row inserted/updated/deletedij> insert into w_2 values(2);1 row inserted/updated/deletedij> -- test ALLsselect * from s_3rows where s_3rows.i not in (select i from t_1);I -----------2 ij> select * from s_3rows where s_3rows.i <> ALL (select i from t_1);I -----------2 ij> select * from s_3rows where s_3rows.i >= ALL (select i from t_1);I -----------1 2 ij> select * from s_3rows where s_3rows.i > ALL (select i from t_1);I -----------2 ij> select * from s_3rows where s_3rows.i <= ALL (select i from t_1);I -----------1 ij> select * from s_3rows where s_3rows.i < ALL (select i from t_1);I -----------ij> select * from s_3rows where s_3rows.i = ALL (select i from t_1);I -----------1 ij> select * from s_3rows where s_3rows.i not in (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i <> ALL (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i >= ALL (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i > ALL (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i <= ALL (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i < ALL (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i = ALL (select i from u_null);I -----------ij> select * from s_3rows where s_3rows.i not in (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i <> ALL (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i >= ALL (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i > ALL (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i <= ALL (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i < ALL (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i = ALL (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i not in (select i from w_2);I -----------1 ij> select * from s_3rows where s_3rows.i <> ALL (select i from w_2);I -----------1 ij> select * from s_3rows where s_3rows.i >= ALL (select i from w_2);I -----------2 ij> select * from s_3rows where s_3rows.i > ALL (select i from w_2);I -----------ij> select * from s_3rows where s_3rows.i <= ALL (select i from w_2);I -----------1 2 ij> select * from s_3rows where s_3rows.i < ALL (select i from w_2);I -----------1 ij> select * from s_3rows where s_3rows.i = ALL (select i from w_2);I -----------2 ij> select * from w_2 where w_2.i = ALL (select i from w_2);I -----------2 ij> -- NOT = ANY <=> <> ALLselect * from s_3rows where NOT s_3rows.i = ANY (select i from w_2);I -----------1 ij> select * from s_3rows where s_3rows.i <> ALL (select i from w_2);I -----------1 ij> select * from s_3rows where NOT s_3rows.i = ANY (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i <> ALL (select i from v_empty);I -----------NULL 1 2 ij> -- NOT <> ANY <=> = ALLselect * from s_3rows where NOT s_3rows.i <> ANY (select i from w_2);I -----------2 ij> select * from s_3rows where s_3rows.i = ALL (select i from w_2);I -----------2 ij> select * from s_3rows where NOT s_3rows.i <> ANY (select i from v_empty);I -----------NULL 1 2 ij> select * from s_3rows where s_3rows.i = ALL (select i from v_empty);I -----------NULL 1 2 ij> -- NOT >= ANY <=> < ALLselect * from s_3rows where NOT s_3rows.i >= ANY (select i from w_2);I -----------1 ij> select * from s_3rows where s_3rows.i < ALL (select i from w_2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -