READ Free Dumps For Oracle- 1z0-007
Question ID 7941 | The EMPLOYEES table contains these columns: LAST_NAME VARCHAR2 (25) SALARY NUMBER (6,2) COMMISSION_PCT NUMBER (6) You need to write a query that will produce these results: 1. Display the salary multiplied by the commission_pct. 2. Exclude employees with a zero commission_pct. 3. Display a zero for employees with a null commission value. Evaluate the SQL statement: SELECT LAST_NAME, SALARY*COMMISSION_PCT FROM EMPLOYEES WHERE COMMISSION_PCT IS NOT NULL; What does the statement provide?
|
Option A | All of the desired results
|
Option B | Two of the desired results
|
Option C | One of the desired results
|
Option D | An error statement
|
Correct Answer | C |
Explanation Explanation/Reference: Explanation: This statement will provide only one of the desired results: display the salary multiplied by the commission_pct. It will not exclude employees with a zero commission_pct and display a zero for employees with a null commission value. Incorrect Answers A: This statement will provide only one of the desired results, not all. B: This statement will provide only one of the desired results, not two. D: This statement will not generate an error, it is correct . OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 25-38 Chapter 1: Overview of Oracle Databases
Question ID 7942 | Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?
|
Option A | SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;
|
Option B | SELECT TO_DATE(SYSDATE,'yyyy') FROM dual;
|
Option C | SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;
|
Option D | SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;
|
Option E | SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy') FROM dual;
|
Correct Answer | A |
Explanation Explanation/Reference: Explanation: Function TO_CHAR(x, y) converts the value x to a character or converts a date to a character string using formatting conventions. Incorrect Answers B: Function TO_DATE(x,[y]) converts the non-date value x to a date using the format specified by x. C: The DECODE function is used as substitution of IF-THEN-ELSE PL/SQL construction in SQL queries. The SELECT statement provides incorrect syntax of it because it cannot have only two parameters. D: The DECODE function is used as substitution of IF-THEN-ELSE PL/SQL construction in SQL queries. The SELECT statement provides incorrect syntax of it because it cannot have only two parameters. E: This statement provide incorrect syntax of TO_CHAR() function: it requires only one parameter, not two. OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 86-87 Chapter 2: Limiting, Sorting, and Manipulating Return Data