当前位置: Oracle DBA培训网-优技培训 >> oracle培训 > Oracle培训教程 >

Oracle入门:between and区间操作符

Oracle入门:between and区间操作符

Oracle入门:between and区间操作符,在WHERE子句中,可以使用BETWEEN操作符来查询列值包含在指定区间内的行。比如,查询工资从1000到2000之间的员工。可以使用传统方法:

WHERE SAL>=1000 AND SAL<=2000

也可以使用:

WHERE SAL BETWEEN 1000 AND 2000

BWTWEEN操作所指定的范围也包括边界。

代码演示:BETWEEN操作

SQL> SELECT ename,job,sal FROM EMP WHERE sal BETWEEN 1000 AND 2000;

ENAME

JOB

SAL

ALLEN

SALESMAN

1600

WARD

SALESMAN

1250

MARTIN

SALESMAN

1250

TURNER

SALESMAN

1500

ADAMS

CLERK

1100

MILLER

CLERK

1300

6 rows selected

技术沙龙MORE+

标签错误:<!-- #Label# labelId=20160707140604 moduleId=1 classId=12231768634 orderby=2 fields=url,title,u_info attribute= datatypeId=22192428132 recordCount=3 pageSize= <htmlTemplate><dt><img src="/images/index_26${index}.jpg" width="100" height="62" /><a href="$url" title="${title}">${title}</a><span>${api.left(u_info,60)}</span></dt></htmlTemplate> -->
我要参加技术沙龙