Oracle SQL比较运算符

开发工具与关键技术:Oracle sql*plus  PLSQL Developer
作者:杨春桃   撰写时间:2019-04-07
撰写时间:2019年04月07日

其它比较运算符:

操作符 含义
Between…and… 在两个值之间(包含边界)
In(set) 等于值列表中的一个
like 模糊查询
Is null 空值

Between…and…显示在一个区间内的值(左边放小值,右边放大值)
Select last_name,salary from employees where salary between 3000 and 6000;
在这里插入图片描述
还可以这样写:
Select last_name,salary from employees where salary>=3000 and salary<=6000;
在这里插入图片描述

In :显示列表中的值(in里面的值可以有不成立的)
Select last_name,salary,department_id
From employees
Where department_id in(30,40,50)
在这里插入图片描述
还可以这样:
Select last_name,salary,department_id
From employees
Where department_id=30 or department_id=40 or department_id=55
Like:选择类似的值(模糊查询)
Select first_name from employees where first_name like ‘S%’
在这里插入图片描述
ECSAPE:转义字符
Select job_id from employees where job_id like ‘IT_%’ escape ‘\’
在这里插入图片描述
Is null:空值(查找出空值)
Select last_name,commission_pct
From employees
Where commission_pct is null
在这里插入图片描述
Is not null 有值(查找出有值的)
Select last_name,commission_pct
From employees
Where commission_pct is not null
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44552861/article/details/89067039