Professional Documents
Culture Documents
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
The TO_CHAR function can be used to remove text from column data
that will be returned by the database.
The TO_CHAR function can be used to display dates and numbers
according to formatting conventions that are supported by Oracle. (*)
The TO_CHAR function can be used to specify meaningful column
names in an SQL statement's result set.
The TO_CHAR function can only be used on Date columns.
Correct
4. You need to display the HIRE_DATE values in this format: 25th of July
2002. Which SELECT statement would you use?
Mark for
Review
(1) Points
Mark for
EMPLOYEE_ID NUMBER(9)
LAST_NAME VARCHAR2 (25)
FIRST_NAME VARCHAR2 (25)
HIRE_DATE DATE
Review
(1) Points
6. Sysdate is 12-May-2004.
You need to store the following
date: 7-Dec-89
Which statement about the
date format for this value is
true?
Both the YY and RR date
formats will interpret the
year as 1989
Mark for
Review
(1) Points
Mark for
Review
(1) Points
SELECT last_name,
NVL2(commission_pct,
manager_id, -1) comm
FROM employees ;
King, -1
Kochhar, -1
Vargas, -1
Zlotkey, 100
(*)
Statement will fail.
King, -1
Kochhar, 100
Vargas, 124
Zlotkey, .2
King, -1
Kochhar, -1
Vargas, -1
Zlotkey, .2
Incorrect. Refer to Section
5 Lesson 2.
8. Which function compares two
expressions?
Mark for
Review
(1) Points
NVL2
NULLIF (*)
NVL
NULL
Correct
9. You need to replace null values
in the DEPT_ID column with
the text N/A. Which functions
should you use?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
SELECT
NVL(tuition_balance, 0),
NVL (housing_balance),
tuition_balance +
housing_balance "Balance
Due"
FROM student_accounts;
SELECT tuition_balance +
housing_balance
FROM student_accounts;
SELECT
TO_NUMBER(tuition_balan
ce, 0), TO_NUMBER
(housing_balance, 0),
tutition_balance +
housing_balance "Balance
Due"
FROM student_accounts;
SELECT NVL
(tuition_balance +
housing_balance, 0)
"Balance Due"
FROM student_accounts;
(*)
Correct
11. Which
stateme
nt about
group
function
s is
true?
NVL and NVL2, but not COALESCE, can be used with group
functions to replace null values.
NVL and COALESCE, but not NVL2, can be used with group
functions to replace null values.
COALESCE, but not NVL and NVL2, can be used with group
functions to replace null values.
NVL, NVL2, and COALESCE can be used with group functions
to replace null values. (*)
Correct
12. 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
Mark for
Review
(1) Points
King, -1
Kochhar, 100
Vargas, 124
Zlotkey, 100
Statement will fail
King, -1
Kochhar, 100
Vargas, 124
Zlotkey, .2
(*)
King, null
Kochhar, 100
Vargas, 124
Zlotkey, .2
Correct
13. 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,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;
SELECT last_name,salary,
(CASE WHEN salary<5000 THEN 'Low'
WHEN sal <10000 THEN 'Medium'
WHEN sal <20000 THEN 'Good'
ELSE 'Excellent'
END) qualified_salary
FROM employees;
Correct
14. Which of the following is a conditional expression used in SQL?
Mark for
Review
(1) Points
CASE (*)
DESCRIBE
NULLIF
WHERE
Correct
15. 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
King, A N Other
Kochhar, King
De Haan, King
Hunold, A N Other
Ernst, A N Other
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, Kochhar
Ernst, De Haan
Invalid statement.
Correct