OCP 1Z0 051 QUESTION NO: 7
2014-06-02 17:05
363 查看
QUESTION NO: 7
Evaluate these two SQL statements:
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC;
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
What is true about them?
A. The two statements produce identical results.
B. The second statement returns a syntax error.
C. There is no need to specify DESC because the results are sorted in descending order by
default.
D. The two statements can be made to produce identical results by adding a column alias for the
salary column in the second SQL statement.
1 order by 默认升序
2 order by 后可以用列位置、列名、别名
Answer: A
Evaluate these two SQL statements:
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC;
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
What is true about them?
A. The two statements produce identical results.
B. The second statement returns a syntax error.
C. There is no need to specify DESC because the results are sorted in descending order by
default.
D. The two statements can be made to produce identical results by adding a column alias for the
salary column in the second SQL statement.
1 order by 默认升序
2 order by 后可以用列位置、列名、别名
TEST > show user User is "test" TEST > create table EMPLOYEES as select * from hr.EMPLOYEES where rownum <=5; Table created TEST > TEST > SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC; LAST_NAME SALARY HIRE_DATE ------------------------- ---------- ----------- Hartstein 13000.00 2004-02-17 Fay 6000.00 2005-08-17 Whalen 4400.00 2003-09-17 OConnell 2600.00 2007-06-21 Grant 2600.00 2008-01-13 5 rows selected TEST > SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC; LAST_NAME SALARY HIRE_DATE ------------------------- ---------- ----------- Hartstein 13000.00 2004-02-17 Fay 6000.00 2005-08-17 Whalen 4400.00 2003-09-17 OConnell 2600.00 2007-06-21 Grant 2600.00 2008-01-13 5 rows selected
Answer: A
相关文章推荐
- OCP 1Z0 051 QUESTION NO: 16
- OCP 1Z0 051 QUESTION NO: 29
- OCP 1Z0 051 QUESTION NO: 43
- OCP 1Z0 051 QUESTION NO: 1
- OCP 1Z0 051 QUESTION NO: 17
- OCP 1Z0 051 QUESTION NO: 30
- OCP 1Z0 051 QUESTION NO: 44
- OCP 1Z0 051 QUESTION NO: 54
- OCP 1Z0 051 QUESTION NO: 2
- OCP 1Z0 051 QUESTION NO: 45
- OCP 1Z0 051 QUESTION NO: 55
- OCP 1Z0 051 QUESTION NO: 3
- OCP 1Z0 051 QUESTION NO: 18
- OCP 1Z0 051 QUESTION NO: 46
- OCP 1Z0 051 QUESTION NO: 4
- OCP 1Z0 051 QUESTION NO: 19
- OCP 1Z0 051 QUESTION NO: 31
- OCP 1Z0 051 QUESTION NO: 47
- OCP 1Z0 051 QUESTION NO: 5
- OCP 1Z0 051 QUESTION NO: 32