2021-08-08 17:16:22 +00:00
|
|
|
-- { echo }
|
|
|
|
select 1 intersect select 1;
|
|
|
|
select 2 intersect select 1;
|
|
|
|
select 1 except select 1;
|
|
|
|
select 2 except select 1;
|
2021-08-10 06:24:12 +00:00
|
|
|
|
2021-08-13 09:57:15 +00:00
|
|
|
select number from numbers(20) intersect select number from numbers(5, 5);
|
2021-08-08 17:16:22 +00:00
|
|
|
select number from numbers(10) except select number from numbers(5);
|
|
|
|
select number, number+10 from numbers(12) except select number+5, number+15 from numbers(10);
|
2021-08-10 06:24:12 +00:00
|
|
|
|
|
|
|
select 1 except select 2 intersect select 1;
|
|
|
|
select 1 except select 2 intersect select 2;
|
|
|
|
select 1 intersect select 1 except select 2;
|
|
|
|
select 1 intersect select 1 except select 1;
|
|
|
|
select 1 intersect select 1 except select 2 intersect select 1 except select 3 intersect select 1;
|
|
|
|
select 1 intersect select 1 except select 2 intersect select 1 except select 3 intersect select 2;
|
2021-08-13 09:57:15 +00:00
|
|
|
select 1 intersect select 1 except select 2 intersect select 1 except select 3 intersect select 2 except select 1;
|
2021-08-10 06:24:12 +00:00
|
|
|
|
2021-08-12 11:42:51 +00:00
|
|
|
select number from numbers(10) except select 5;
|
2021-08-10 06:24:12 +00:00
|
|
|
select number from numbers(100) intersect select number from numbers(20, 60) except select number from numbers(30, 20) except select number from numbers(60, 20);
|
2021-08-12 11:42:51 +00:00
|
|
|
|
2021-08-13 12:07:44 +00:00
|
|
|
select * from (select 1 intersect select 1);
|
2021-08-12 11:42:51 +00:00
|
|
|
with (select number from numbers(10) intersect select 5) as a select a * 10;
|
2021-08-15 06:55:43 +00:00
|
|
|
with (select 5 except select 1) as a select a except select 5;
|
|
|
|
with (select number from numbers(10) intersect select 5) as a select a intersect select 1;
|
|
|
|
with (select number from numbers(10) intersect select 5) as a select a except select 1;
|
2021-08-12 11:42:51 +00:00
|
|
|
select count() from (select number from numbers(10) except select 5);
|
|
|
|
select count() from (select number from numbers(1000000) intersect select number from numbers(200000, 600000));
|
|
|
|
select count() from (select number from numbers(100) intersect select number from numbers(20, 60) except select number from numbers(30, 20) except select number from numbers(60, 20));
|
2021-08-13 09:57:15 +00:00
|
|
|
select count() from (select number from numbers(100) intersect select number from numbers(20, 60) except select number from numbers(30, 20) except select number from numbers(60, 20) union all select number from numbers(100, 10));
|
2021-08-12 11:42:51 +00:00
|
|
|
select count() from (select number from numbers(1000000) intersect select number from numbers(200000, 600000) except select number from numbers(300000, 200000) except select number from numbers(600000, 200000));
|
|
|
|
|
2021-08-16 20:34:39 +00:00
|
|
|
select count() from (select 1 intersect select 1) limit 100;
|
|
|
|
select count() from (select 1 except select 2) limit 100;
|
|
|
|
with (select count() from (select 1 union distinct select 2 except select 1)) as max
|
|
|
|
select count() from (select 1 union all select max) limit 100;
|
|
|
|
|
2021-08-12 11:42:51 +00:00
|
|
|
select 1 union all select 1 intersect select 1;
|
|
|
|
select 1 union all select 1 intersect select 2;
|
2021-08-13 09:57:15 +00:00
|
|
|
select * from (select 1 union all select 2 union all select 3 union all select 4 except select 3 union all select 5) order by 1;
|
|
|
|
select * from (select 1 union all select 2 union all select 3 union all select 4 intersect select 3 union all select 5) order by 1;
|
2021-08-13 12:07:44 +00:00
|
|
|
select * from (select 1 union all select 2 union all select 3 union all select 4 intersect select 3 union all select 5 except select 1) order by 1;
|
2021-08-14 12:31:55 +00:00
|
|
|
|
|
|
|
select 1 intersect (select 1 except select 2);
|
|
|
|
select 1 union all select 2 except (select 2 except select 1 union all select 1) except select 4;
|
2021-08-15 06:55:43 +00:00
|
|
|
select 1 intersect select count() from (select 1 except select 2 intersect select 2 union all select 1);
|
2021-08-14 12:31:55 +00:00
|
|
|
|
|
|
|
explain syntax select 1 intersect select 1;
|
|
|
|
explain syntax select 1 except select 1;
|
|
|
|
explain syntax select 1 union all select 2 except (select 2 except select 1 union all select 1) except select 4;
|