Friday, February 24, 2006

lesson1

Lesson1


1. Using the three separate words "Oracle," "Internet," and "Academy," use one command to produce the following output:
The Best Class
Oracle Internet Academy
Select concat('Oracle','Internet')||'Academy' AS "The Best Class"
From DUAL

2. Use the string "Oracle Internet Academy" to produce the following output:
The Net
net
Select substr('Oracle Internet Academy',13,3) AS "The Net"
From DUAL
3. What is the length of the string "Oracle Internet Academy"?
Select length('Oracle Internet Academy')
From DUAL

4. What's the position of " I " in "Oracle Internet Academy"?

Select instr('Oracle_Internet_Academy','I')
From DUAL
5. Starting with the string "Oracle Internet Academy", pad the string to create ****Oracle****Internet****Academy****
Select lpad('Oracle',10,'*')||lpad('Inernet',12,'*')||lpad('Academy',11,'*')||rpad('*',4,'*')
From DUAL


6. Starting with the string "Oracle Internet Academy", pad the string to produce
Oracle$$$Internet$$$Academy
Select rpad('Oracle',9,'&')||rpad('Inernet',11,'&')||'Academy'
From DUAL

7. Using the string 'Oracle Internet Academy', produce the output shown using the REPLACE function.
The Best Class
Oracle 2004-2005 Academy

Select replace('Oracle 2004-2005 Academy','Oracle Inernet Academy')AS " The Best Class"
From DUAL

8. List the order date and the order total from the Global Fast Foods F_ORDERS table. Name the order total as TOTAL, and fill in the empty spaces to the left of the order total with $.
select order_date,lpad('order total',7,'$')"TOTAL"
from F_ORDERS

9. Write a query that will output a column called “ADDRESS” which has the following information: ZOE TWEE 1009 OLIVER AVENUE BOSTON, MA 12889. Use the Global Fast Foods F_CUSTOMERS table.
select first_name||' '||last_name||' '||address||' '||','||' '||city||' '||state||' '||zip||' '||'.'
from F_CUSTOMERS
where id=456

0 Comments:

Post a Comment

<< Home