当前位置:网站首页>Gbase8s database intersect operator
Gbase8s database intersect operator
2022-07-22 18:10:00 【Like to eat radish ice cold】
When combining two queries with this set operator ,INTERSECT Calculates the number of rows returned by two queries for its operand
intersection .
INTERSECT The returned row shows the left and right SELECT The result set of the statement .INTERSECT The result is usually
Different or unique lines , because INTERSECT Eliminate any duplicate lines .
Consider the following example , One of the tables t1 There are the following lines :
create table t1 (col1 int);
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (2);
insert into t1 values (2);
insert into t1 values (3);
insert into t1 values (4);
insert into t1 values (4);
insert into t1 values (NULL);
insert into t1 values (NULL);
insert into t1 values (NULL);
In the same example , surface t2 There are these lines :
create table t2 (col1 int);
insert into t2 values (1);
insert into t2 values (3);
insert into t2 values (4);
insert into t2 values (4);
insert into t2 values (NULL);
The following queries are from INTERSECT The two queries on the left and right of the operation object return different rows . Important questions to note here
The problem is that the result has NULL value . Because when the table t2 And watch t1 When comparing , Considering the table t2 Medium NULL The value is phase
Waiting , So from this intersection NULL Value is returned in the combined result set :
SELECT col1 FROM t1 INTERSECT SELECT col1 FROM t2;
col1
1
3
4
4 row(s) retrieved
INTERSECT Operators have some ( But not all ) And UNION Operators have the same restrictions , but INTERSECT No
Hold to make UNION Capable of returning duplicate values ALL keyword . See also the topic For combined SELECT The limitation of .
边栏推荐
- Differences between MySQL and MariaDB
- 架构篇(一)什么是架构
- Use of bullets in object pool mode in aircraft war
- 力扣练习——25 无重叠区间
- Fibonacci series of Niuke network
- 力扣练习——35 组合总和 II
- Using dichotomy to find the elements of an array
- VCs and Verdi learning records
- 毕业985,工作996,也躲不开中年危机
- [micro Service ~ remote call] integrate resttemplate, webclient, feign
猜你喜欢
异常的理解学习
Dokcer running Nacos container automatic exit problem
基础SQL Server 操作问题——仅当使用了列表并且IDENTITY_INSERT为ON时,才能为表中的标识列制定显示值
毕业985,工作996,也躲不开中年危机
Linear regression (formula derivation +numpy Implementation)
Methods of downloading literature from IEEE
[case sharing] configure the routing penetration function of IS-IS
JS String charAt substring() substr slice toUpperCase toLowerCase indexOf
并发模型值Actor和CSP
【3D目标检测】稀疏卷积
随机推荐
Shallow solution of ZMQ lockless queue
Aruba学习笔记04-Web UI --Configuration面板介绍
力扣练习——25 无重叠区间
分布式(一)分布式系统,BASE,CAP是何方神圣?
24、 TF coordinate transformation (IV): multi coordinate transformation and coordinate system relationship view
GBase8s数据库SET CONNECTION 语句
go 切片,集合简单讲解
Unity textmeshpro namespace reference and component acquisition
等额本金递增还款/等额本金递减按揭房贷还款计算器
Evolution of multi activity in different places
GBase8s数据库SET Database Object Mode 语句
力扣练习——31 有效的井字游戏
Using dichotomy to find the elements of an array
Data link layer of network (PPP Protocol)
RK3399平台开发系列讲解(ALSA子系统)4.37、ALSA驱动框架
Vscode failed to install tools
【OpenCV入门实战】利用电脑前置摄像头进行人脸检测
力扣练习——28 拼接最大数
【Excle】生成guid和datetime导入测试数据到数据库
GBase8s数据库SET CONSTRAINTS 语句