1Z0-007 · Question #140
Management has asked you to calculate the value 12salary commission_pct for all the employees in the EMP table. The EMP table contains these columns: Which statement ensures that a value is…
The correct answer is C. SELECT last_name, 12*salary*(nvl(commission_pct,0)) FROM emp. This SELECT statement provides correct usage of NVL function to calculate columns for all employees. Oracle give you possibility to substitute a value in place of NULL. The basic syntax for NVL() is NVL(column_name, value_if_null). Notice that the column specified in NVL()…
Question
Management has asked you to calculate the value 12salary commission_pct for all the employees in the EMP table. The EMP table contains these columns:
Which statement ensures that a value is displayed in the calculated columns for all employees?
Options
- ASELECT last_name, 12salary commission_pct
- BSELECT last_name, 12salary (commission_pct,0) FROM emp;
- CSELECT last_name, 12salary(nvl(commission_pct,0)) FROM emp;
- DSELECT last_name, 12salary(decode(commission_pct,0)) FROM emp;
How the community answered
(34 responses)- A6% (2)
- B18% (6)
- C74% (25)
- D3% (1)
Explanation
This SELECT statement provides correct usage of NVL function to calculate columns for all employees. Oracle give you possibility to substitute a value in place of NULL. The basic syntax for NVL() is NVL(column_name, value_if_null). Notice that the column specified in NVL() contains an actual value. That value is what Oracle returns; when the column is NULL, the special string is returned. The value specified to be returned if the column value is NULL must be the same datatype as the column specified. Incorrect Answers A: This SELECT statement will return NULL value for rows with NULL COMMISION_PCT B: It is incorrect syntax in this query: NVL function needs to be used for correct result. 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 cannot have only two parameters.
Topics
Community Discussion
No community discussion yet for this question.