miercuri, 24 februarie 2010

Quiz: Null Functions

Test: Quiz: Null Functions
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1

1. With the following data in Employees (last_name, commission_pct, manager_id) what is the result of the following statement?
DATA:
King,null,null
Kochhar, null,100
Vargas, null, 124
Zlotkey,.2, 100

SELECT last_name, NVL2(commission_pct, manager_id, -1) comm
FROM employees ;

Mark for Review
(1) Points


King, -1
Kochhar, -1
Vargas, -1
Zlotkey, .2



Statement will fail.



King, -1
Kochhar, 100
Vargas, 124
Zlotkey, .2



King, -1
Kochhar, -1
Vargas, -1
Zlotkey, 100

(*)



Correct Correct


2. The following statement returns 0 (zero). True or False?

SELECT 121/NULL
FROM dual;

Mark for Review
(1) Points


True


False (*)



Correct Correct


3. Which function compares two expressions? Mark for Review
(1) Points


NVL


NULLIF (*)


NVL2


NULL



Correct Correct


4. If quantity is a number datatype, what is the result of this statement?
SELECT NVL(200/quantity, 'zero') FROM inventory;

Mark for Review
(1) Points


zero


ZERO


The statement fails (*)


Null



Correct Correct


5. Consider the following data in the Employees table:
(last_name, commission_pct, manager_id)
DATA:
King,null,null
Kochhar, null,100
Vargas, null, 124
Zlotkey,.2, 100

What is the result of the following statement:

SELECT last_name, COALESCE(commission_pct, manager_id, -1) comm
FROM employees ;

Mark for Review
(1) Points


Statement will fail



King, -1
Kochhar, 100
Vargas, 124
Zlotkey, .2

(*)


King, -1
Kochhar, 100
Vargas, 124
Zlotkey, 100



King, null
Kochhar, 100
Vargas, 124
Zlotkey, .2




Correct Correct



( Vrei sa traduci ceva?Want to translate something? http://translate.google.ro/# )

Un comentariu:

  1. M-ai ajutat foarte mult. Unele raspunsuri le-am folosit doar pentru verificare, iar altele m-au ajutat.
    Multumesc ptr ajutor.

    RăspundețiȘtergere