ocp – sybex 007学习笔记-chapter 1 test

1、在没有alter session set nls_date_format ‘yyyy-mm-dd hh24:mi:ss’之前,select length(sysdate) from dual;这个是等于9的,原因是length含有一个隐式转换length(to_char(sysdate)),而to_char后的sysdate是9位的,格式是:DD-MON-YY。

2、distinct必须紧跟select,以下语句是错误的:select aa,distinct bb,cc from table。

3、EMPNO ENAME SALARY COMM DEPTNO
——— ———- ——— ——— ———
7369 SMITH 800 20
7499 ALLEN 1600 300 30
7521 WARD 1250 500 30
7566 JONES 2975 20
7654 MARTIN 1250 1400 30
7698 BLAKE 2850 30
7782 CLARK 2450 24500 10
7788 SCOTT 3000 20
7839 KING 5000 50000 10
7844 TURNER 1500 0 30
7876 ADAMS 1100 20
7900 JAMES 950 30
7902 FORD 3000 20
7934 MILLER 1300 13000 10

Qusetion:

Refer to the listing of records in the EMP table in question 9. How
many rows will the following query return?
SELECT * FROM emp WHERE ename BETWEEN ‘A’ AND ‘C’
A. 4
B. 2
C. A character column cannot be used in the BETWEEN operator.
D. 3

Answer:

D. Here, a character column is compared against a string using the
BETWEEN operator, which is equivalent to ename >= ‘A’ AND ename
<= ‘C’. The name CLARK will not be included in this query, because ‘CLARK’ is > ‘C’.

对于字符型的比较是从左到右一个一个字符的比较的。

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据