[August 2019] OCP latest version of the 071 certification exams test original topic - 32 questions

choose three

Examine this SQL statement:

SELECT custid, cus last_name "Last Name"

FROM customers

WHERE country_id = 10

UNION

SELECT cust_id CUST_NO, cust_last_name

FROM customers

WHERE country_id = 30

Identify three ORDER BY clauses, any one of which can complete the query successfully.

A) ORDERBY 2, 1

B) ORDER BY "CUST_NO"

C) ORDER BY 2,cust_id

D) ORDER BY CUST_NO

E) ORDER BY "Last Name"

Answer:ACE

(Analysis: This problem is resolved with the following resolution, the answer is to find out the summary in accordance with the law of resolution.)

071-140 Title:

SELECT department_id "DEPT_ID", department_name, 'b' FROM departments

WHERE department_id=90 UNION

SELECT department_id, department_name DEPT_NAME, 'a' FROM departments

WHERE department_id=10

Which two ORDER BY clauses can be used to sort output?

A. ORDER BY DEPT_NAME;

B. ORDER BY DEPT_ID;

C. ORDER BY 'b';

D. ORDER BY 3;

Correct Answer: BD

(Analysis: found experimentally alias must be enclosed in double quotes summed up before they can be used to sort; and found took the name alias (alias outlined by double quotation marks) columns can not be used to sort; no summarized in double quotes column aliases may be used to sort; order by 3, can be sorted according to the order of the display column.

Note union ordered to write in order by the time the final statement; sort found only in the first select statement in the column. )

SQL> select empno "CUST_NO",ename "LAST NAME",'a' FROM emp

2 UNION

3 SELECT EMPNO ,ENAME,'b' FROM emp

4 ORDER BY empno;

ORDER BY empno

*

Line 4 errors:

ORA-00904: "EMPNO": identifier is invalid

Guess you like

Origin blog.51cto.com/13854012/2451432