7.8 自测题

(1) 下面哪个查询投影DEPARTMENTS表中DEPARTMENT_NAME和LOCATION_ID列(选择一个最佳答案)?

A.SELECT DISTINCT DEPARTMENT_NAME, LOCATION_ID FROM DEPARTMENTS;

B. SELECT DEPARTMENT_NAME, LOCATION_ID FROM DEPARTMENTS;

C.SELECT DEPT_NAME, LOC_ID FROM DEPT;

D.SELECT DEPARTMENT_NAME AS “LOCATION_ID”FROM DEPARTMENTS;

(2) 在描述EMPLOYEES表之后,你会发现SALARY列的数据类型为NUMBER(8,2)。该列中不允许出现哪些SALARY值(选择所有正确答案)?

A.SALARY=12345678

B. SALARY=123456.78

C.SALARY=1234567.8

D.SALARY=123456

E.SALARY=12.34

(3) 描述JOB_HISTORY表之后,你会发现START_DATE和END_DATE列的数据类型是DATE。考虑表达式“END_DATE-START_DATE”,选择两个描述该表达式的正确句子。

A.返回DATE数据类型的值

B.返回NUMBER类型的值

C.返回VARCHAR2类型的值

D.表达式无效,因为在使用DATE数据类型的列上不能执行算术运算

E.表达式有效,因为在使用DATE数据类型的列上可以执行算术运算

(4) 哪个语句返回来自EMPLOYEES表的唯一JOB_ID值(选择一个最佳答案)?

A.SELECT JOB_ID FROM EMPLOYEES;

B. SELECT UNIQUE JOB_ID FROM EMPLOYEES;

C.SELECT DISTINCT JOB_ID, EMPLOYEE_ID FROM EMPLOYEES;

D.SELECT DISTINCT JOB_ID FROM EMPLOYEES;

(5) 选择两个不合法的语句。两个正确语句生成相同的结果。两个不合法语句会产生错误:

A.SELECT DEPARTMENT_ID|| ' represents the ' ||DEPARTMENT_NAME||' Department' as "Department Info"FROM DEPARTMENTS;

B. SELECT DEPARTMENT_ID|| ' represents the ||DEPARTMENT_NAME||' Department' as "Department Info"FROM DEPARTMENTS;

C.select department_id|| ' represents the '||department_name||' Department' "Department Info"from departments;

D.SELECT DEPARTMENT_ID represents the DEPARTMENT_NAME Department as"Department Info"FROM DEPARTMENTS;

(6) 下面SELECT语句中的哪两个子句有助于选择和投影(选择一个最佳答案)?

A.SELECT, FROM

B. ORDER BY, WHERE

C.SELECT, WHERE

D.SELECT, ORDER BY

(7) 请选择一个WHERE子句,它从DEPARTMENTS表中提取包含字符字面值“er”的DEPARTMENT_NAME值。SELECT和FROM子句是SELECT DEPARTMENT_NAME FROM DEPARTMENTS(选择一个最佳答案)。A. WHERE DEPARTMENT_NAME IN ('%e%r');

B. WHERE DEPARTMENT_NAME LIKE '%er%';

C.WHERE DEPARTMENT_NAME BETWEEN 'e' AND 'r';

D.WHERE DEPARTMENT_NAME CONTAINS 'e%r';

(8) 下面哪些条件相互对等(选择所有正确答案)?

A.WHERE SALARY <=5000 AND SALARY >=2000

B. WHERE SALARY IN (2000,3000,4000,5000)

C.WHERE SALARY BETWEEN 2000 AND 5000

D.WHERE SALARY > 2000 AND SALARY < 5000

E.WHERE SALARY >=2000 AND <=5000

(9) 请选择两条关于ORDER BY子句错误的陈述(选择一个最佳答案)。

A.使用ORDER BY子句时,它总是带有一个行限制子句

B. ORDER BY子句可以出现在不包含WHERE子句的SELECT语句中

C.ORDER BY子句指定一项或者多项,并依据这些项排序检索的行。这些项只能是列名

D.通过在ORDER BY子句中指定列的数字位置(按它们在SELECT列表中的顺序)来实现位置排序

(10) 在下面的查询中使用&符号替换变量时,首次执行查询,会提示为名为JOB的变量输入一个值,这种提示会出现多少次(选择一个最佳答案)?

SELECT FIRST_NAME, '&JOB'

FROM EMPLOYEES

WHERE JOB_ID LIKE '%'||&JOB||'%'

AND '&&JOB' BETWEEN 'A' AND 'Z';

A.0

B. 1

C.2

D.3

(11) 在以下查询中使用限制行的子句时,会返回什么员工信息? (选择一个最佳答案)

SELECT employee_id, first_name

FROM employees

ORDER BY employee_id

OFFSET 5 ROWS FETCH NEXT 5 ROWS ONLY;

A.employee_id最高的5名员工

B. employee_id最低的5名员工

C.employee_id最低的第6到第10名员工

D.employee_id最高的第6到第10名员工

E.employee_id最低的10名员工

F.以上都不是