
| 操作符 | 用途 | 例子 |
| + - | 表示正数或负数,正数可省去 + | -1234.56 |
| + | 将两个数或表达式进行相加 | A=c+b |
| - | 将两个数或表达式进行相减 | 34-12 |
| * | 将两个数或表达式进行相乘 | 12*34 |
| / | 除以一个数或表达式 | 18*11 |
| NULL | 空值判断 | Where name is null; |
| || | 字符串连接 | ‘101-’||tel_num |
| = | 等于测试 | Select * from emp where name=’赵元杰’; |
| != 或<>或^= | 不等于测试 | Select * from emp where name !=’赵元杰’; |
| < | 小于测试 | Select * from emp Where sal < 5000; |
| > | 大于测试 | Select * from emp Where sal > 5000; |
| <= | 小于等于测试 | Select * from emp Where sal <= 5000; |
| >= | 大于等于测试 | Select * from emp Where sal >= 5000; |
| Not in | 测试某值是否在一个指定的结果集中 | Select name,addr from expert where local not in(‘北京’,’上海’); |
| ANY | 将一个值与一组值进行比较,返回满足条件的结果。必须跟!=,<,>,<=,>= 注: 取最大的那个 | select ename,sal from emp where sal<= any(select sal from emp where deptno=10) |
| SOME | 同ANY,必须跟!=,<,>,<=,>= 注: 取最大的那个 | |
| ALL | 将一个值与一组值比较,返回满足条件的所有列值。必须跟!=,<,>,<=,>= 注: 取最小的那个 | Select name,sal from emp Where sal<= all ( 500,800,1200); |
| Not between A and B | 判断某个值是否界于两者之间。 | Select name,sal from emp Where sal between 500 and 1200; |
| [not]exists | 判断某个列是否存在于一组值中。 | select dname,deptno from dept where exists (select * from emp where dept.deptno=emp.deptno) |
| A[not]like b [Escape ‘char’] | 比较两个模式是否相似,当使用like 语句时Oracle不去访问索引。 | Select * from emp Where ename like ‘TH%’; |
| Is [not] null | 测试值是否为空。 | Select ename,deptno from emp Where comm. Is null or comm.=0; |
| Not | 对结果的否定。 | Select * from emp Where sal not(sal<1000); 等价于 select ename,sal from emp where sal>=1000; |
| AND | 用于判断两个条件十分都满足。 | Select * from emp where Ename=’SIMTH’ and sal>=1000; |
| OR | 用于判断两个条件中是否有一个满足。 | Select * from emp where Ename=’SIMTH’ or ename=’SCOTT’; |
| UNION | 用于返回(组合)两个查询中所有唯一的行。 | Select ename from emp union Select ename from emp; |
| UNION ALL | 用于返回(组合)两个查询中所有所有的行。 | |
| INTERSECT | 用于返回两个查询中相同的行。 | Select ename from emp1 intersect select ename from emp2; |
| MINUS | 用于返回两个查询中的不同的行。 |
