miercuri, 24 februarie 2010

Quiz: Conditional Expressions

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

1. For the given data from Employees (last_name, manager_id) what is the result of the following statement:
DATA:
( King, null
Kochhar, 100
De Haan, 100
Hunold, 102
Ernst, 103)

SELECT last_name,
DECODE(manager_id, 100, 'King', 'A N Other') "Works For?"
FROM employees

Mark for Review
(1) Points


King, Null
Kochhar, King
De Haan, King
Hunold, A N Other
Ernst, A N Other



King, A N Other
Kochhar, King
De Haan, King
Hunold, A N Other
Ernst, A N Other

(*)


Invalid statement.



King, A N Other
Kochhar, King
De Haan, King
Hunold, Kochhar
Ernst, De Haan




Correct Correct


2. CASE and DECODE evaluate expressions in a similar way to IF-THEN-ELSE logic. However, DECODE is specific to Oracle syntax. True or False? Mark for Review
(1) Points


True (*)


False



Correct Correct


3. Which of the following is a conditional expression used in SQL? Mark for Review
(1) Points


CASE (*)


DESCRIBE


WHERE


NULLIF



Correct Correct


4. Which statement will return a listing of last names, salaries and a rating of 'Low', 'Medium', 'Good' or 'Excellent' depending on the salary value? Mark for Review
(1) Points


SELECT last_name,salary,
(CASE WHEN salary < 5000 THEN 'Low' WHEN salary < 10000 THEN 'Medium' WHEN salary < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; (*) SELECT last_name,salary, (CASE WHEN sal < 5000 THEN 'Low' WHEN sal < 10000 THEN 'Medium' WHEN sal < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; SELECT last_name,sal, (CASE WHEN sal < 5000 THEN 'Low' WHEN sal < 10000 THEN 'Medium' WHEN sal < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; SELECT last_name,salary, (RATING WHEN salary < 5000 THEN 'Low' WHEN salary < 10000 THEN 'Medium' WHEN salary < 20000 THEN 'Good' ELSE 'Excellent' END) qualified_salary FROM employees; Correct Correct

http://www.materie.ro/materie/quiz-conditional-expressions-54

Niciun comentariu:

Trimiteţi un comentariu