Review Questions


1.

What is another way to write the following SQL statement by using another function?

select empno || lpad(initcap(ename), 40-length(empno),’.’) "Employee Directory" from emp;

you can rewrite the statement using the concat function: select concat(empno, lpad(initcap(ename), 40-length(empno), . ) `employee directory` from emp;

2.

Which function would you use to perform an explicit conversion from a number to a string?

you can use the tochar function to convert a number to a string.

3.

How can you rewrite the function call NUMTOYMINTERVAL(17,’year’) using the function TOYMINTERVAL?

you can rewrite the function call as toyminterval( 17-00 ) .

4.

What is the result of a number added to a NULL value?

the result of a number added to a null is null .

5.

What is the result of formatting the number -232.6 using the format mask ‘9999.99S’?

the resulting format is 232.60-.

6.

Rank the following operators or conditionals based on priority, from highest to lowest: *, OR, ||, >=

 * , || , - = , or

7.

The DUAL table has how many rows and how many columns?

the dual table has one row and one column. the column is named dummy and has a value of x .

8.

True or false: Strings and numbers can be concatenated.

true, before the number is concatenated with the string, it is implicitlyconverted to a string.

9.

Write a SELECT statement with a built-in function or functions that will format the string ‘Queen’ with the ‘!’ character padded for a total of 20 characters on the left side, and with the ‘?’ character padded for a total of 30 characters on the right. (Hint: Use nested functions.)

 select rpad(lpad( queen ,20, ! ),30, ? ) from dual; rpad(lpad( queen ,20, ! ),30, ------------------------------ !!!!!!!!!!!!!!!queen??????????

10.

What functionality does the new Oracle TIMESTAMP datatype have over the DATE datatype?

the timestamp datatype stores the time in seconds to up to nine digits of precision.

Answers

1.

You can rewrite the statement using the CONCAT function:

select concat(empno, lpad(initcap(ename), 40-length(empno),’.’) "Employee Directory" from emp;

2.

You can use the TOCHAR function to convert a number to a string.

3.

You can rewrite the function call as TOYMINTERVAL(‘17-00’).

4.

The result of a number added to a NULL is NULL.

5.

The resulting format is 232.60-.

6.

*, ||, >=, OR

7.

The DUAL table has one row and one column. The column is named DUMMY and has a value of ‘X’.

8.

True, before the number is concatenated with the string, it is implicitly converted to a string.

9.

select rpad(lpad(‘Queen’,20,’!’),30,’?’) from dual;

RPAD(LPAD(‘QUEEN’,20,’!’),30,’ ------------------------------ !!!!!!!!!!!!!!!Queen??????????

10.

The TIMESTAMP datatype stores the time in seconds to up to nine digits of precision.




Oracle9i DBA JumpStart
Oracle9i DBA JumpStart
ISBN: 0782141897
EAN: 2147483647
Year: 2006
Pages: 138
Authors: Bob Bryla

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net