博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SQL Server MySQL 中的 in 与 null
阅读量:6886 次
发布时间:2019-06-27

本文共 353 字,大约阅读时间需要 1 分钟。

例子:

create table t(x int,y int);

insert into t(x,y) values(1,1),(2,2),(null,null);

查询一:

  select x,y from t where x in (1,2,null);#它并不会返回null的行哦

  

查询二:

  select * from t where x=1 or x=2 or x=null -- 说明 in 只是多个 or = 的语法糖衣吧。

  

查询三:如果要真正的返回null行,可以这样做

  select * from t where x in (1,2) or x is null

  

 

转载于:https://www.cnblogs.com/JiangLe/p/4603978.html

你可能感兴趣的文章
jQuery $.each用法
查看>>
C语言结构体指针成员强制类型转换
查看>>
5.31 dockrer
查看>>
FreeCodeCamp----Intermediate Algorithm Scripting解法
查看>>
软件工程第二章 习题2 第4题
查看>>
《JavaScript设计模式与开发实践》读书笔记之命令模式
查看>>
hdu Problem 1242 Rescue bfs + 优先队列
查看>>
HDU-1507-Uncle Tom's Inherited Land*
查看>>
force里面的射线检测
查看>>
oracle 12.1.0.2中对象锁对系统的较大影响
查看>>
tensorboard的使用
查看>>
java进程占用CPU资源过高分析脚本
查看>>
day17--JQuery实例
查看>>
0312-css样式(选择器、文本text、字体fonts、背景background)
查看>>
【BZOJ】4358: permu 莫队算法
查看>>
powerdesigner 遇到的各种问题总结
查看>>
(转)韦东山linux学习笔记——ubuntu 9.10 软件源问题
查看>>
SQL错误
查看>>
[AX]AX2012 AIF(十一):系统服务之用户会话服务
查看>>
Azure系列2.1 —— com.microsoft.azure.storage.blob
查看>>