Quiz: Conversion Functions

Test: Quiz: Conversion Functions

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 1

 

1. A table has the following definition:

EMPLOYEES(

EMPLOYEE_ID NUMBER(6) NOT NULL,

LAST_NAME VARCHAR2(10) NOT NULL,

MANAGER_ID VARCHAR2(6))

and contains the following rows:

(1001, 'Bob Bevan', '200')

(200,'Natacha Hansen', null)

Will the following query work?

SELECT *

FROM employees

WHERE employee_id = manager_id;

Mark for Review

(1) Points

No, because the WHERE-clause will not find any matching data.

No, because the datatypes of ID and MANAGER are different.

Yes, Oracle will perform implicit datatype conversion. (*)

No. You will have to re-write the statement and perform explicit datatype conversion.

 

2. Which statement will return the salary of e.g. 6000 from the Employees table in the following format $6000.00? Mark for Review

(1) Points

SELECT TO_CHAR(salary, '$99999.00') SALARY

FROM employees(*)

SELECT TO_CHAR(salary, '99999.00') SALARY

FROM employees

SELECT TO_CHAR(salary, '$99999') SALARY

FROM employees

SELECT TO_CHAR(sal, '$99999.00') SALARY

FROM employees

 

3. The following script will run successfully. True or False?

SELECT TO_CHAR(TO_DATE("25-DEC-04",'dd-MON-yy'))

FROM dual

Mark for Review

(1) Points

True

False (*)

 

 

4. Which statement is true about SQL functions? Mark for Review

(1) Points

Functions can convert values or text to another data type.

Functions can round a number to a specified decimal place.

Functions can convert upper case characters to lower case characters.

a, b and c are true. (*)

None of the above statements are true.

 

 

5. 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

SELECT enroll_date(hire_date, 'DDspth "of" Month YYYY')

FROM employees;

SELECT TO_CHAR(hire_date, 'ddth "of" Month YYYY')

FROM employees;(*)

SELECT TO_CHAR(hire_date, 'DDTH "of" Month YYYY')

FROM employees;

SELECT TO_CHAR(hire_date, 'DDspth 'of' Month RRRR')

FROM employees;

 

 

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?

Mark for Review

(1) Points

Both the YY and RR date formats will interpret the year as 1989.

Both the YY and RR date formats will interpret the year as 2089.

The RR date format will interpret the year as 1989, and the YY date format will interpret the year as 2089. (*)

The RR date format will interpret the year as 2089, and the YY date format will interpret the year as 1989.

Solution for Test: Quiz: Introduction to The Oracle Academy
Solution for Test: Quiz: Data vs Information
Top