Monday, February 13, 2006

SQL SECTION 1 LESSON 1
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')//' Acameny' 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(RPAD('Oracle',10,'*')RPAD('Internet',12,'*')RPAD('Academy',11,'*'),37,'*')
FROM dual;
6. Starting with the string "Oracle Internet Academy", pad the string to produce Oracle$$$Internet$$$Academy

---- SELECT RPAD(SUBSTR('Oracle Internet Academy',1,6),9,'$')RPAD(SUBSTR('Oracle Internet Academy',8,8),11,'$')SUBSTR('Oracle Internet Academy',17,7)
FROM dual;

7. Using the string 'Oracle Internet Academy', produce the output shown using the REPLACE function.

---- SELECT REPLACE('Oracle Internet Academy','Internet','2004-2005')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',16,'$') AS"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 "ADDRESS"
from f_customerswhere id=456

4 Comments:

Blogger Henry Ruan said...

Good. Keep working hard!

8:45 PM  
Blogger bianfre said...

ok very good thank you!
but have you number 10 + 11 + 12??

3:23 AM  
Blogger Ridhima said...


I read your articles very excellent and the i agree our all points because all is very good information provided this through in the post. It is very helpful for me. Keep blogging like this. Thanks.

dot net training in adyar

7:20 AM  
Blogger Sports education worldwide said...

I have read your blog its very attractive and impressive. I like it your blog.

ivanka trump hot

4:16 AM  

Post a Comment

<< Home