该条件引导的是从*到*的经过排序后的一个区间根据范围取数据:
SQL> select ename from emp where ename between 'ALLEN' and 'ADAMS';
no rows selected
正常情况:两个ename的位置
SQL> select ename from emp;
ENAME
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
然后换成别的首字母不同的查询:
SQL> select ename from emp where ename between 'ALLEN' and 'KING';
ENAME
----------
ALLEN
JONES
BLAKE
CLARK
KING
JAMES
FORD
7 rows selected.
然后进行排序,可以发现是按照下面的进行范围取数
SQL> select ename from emp where ename between 'ALLEN' and 'KING' order by ename;
ENAME
----------
ALLEN
BLAKE
CLARK
FORD
JAMES
JONES
KING
7 rows selected.
原表的正常情况:
SQL> select ename from emp;
ENAME
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
原表的排序:
SQL> select ename from emp order by ename;
ENAME
----------
ADAMS
ALLEN
BLAKE
CLARK
FORD
JAMES
JONES
KING
MARTIN
MILLER
SCOTT
SMITH
TURNER
WARD
14 rows selected.
阅读(458) | 评论(0) | 转发(0) |