Friday, February 24, 2006

SECTION 1 LESSON 3
1. For DJ on Demand, display the number of months between the event_date of the Vigil wedding and today's date. Round to the nearest month.

----select round(month_between(event_date,sysdate),0)
from d_events
where name=Vigil wedding;

2. Display the days between the start of last summer's school vacation break and the day school started this year. Assume 30.5 days per month. Name the output "Days."

----select round(months_between('13-Sep-05','25-Jun-05')*30.5,0) "Day"

from dual
3. Display the days between January 1 and December 31.

----select (months_between('01-JAN-06','31-DEC-06')/12)*365
from dual;

4. Using one statement, round today's date to the nearest month and nearest year and truncate it to the nearest month and nearest year. Use an alias for each column.

----select round(sysdate,'month') "nearest month", round(sysdate,'year') "nearest year", trunc(sysdate,'month') "Nearest Month", trunc(sysdate,'year') "Nearest Year"

from dual;
5. What is the last day of the month for June 2005? Use an alias for the output.

----select last_day('01-JUN-05')
from dual;

6. Display the number of years between the Global Fast Foods employee Bob Miller's birthday and today. Round to the nearest year.

----select round(months_between(sysdate,birthday)/12,'year')
from f_staffs
where first_name='Bob';

7. Your next appointment with the dentist is six months from today. On what day will you go to the dentist? Name the output, "Appointment."

----select add_months(sysdate,6) as"Appointment"
from dual;
(Appointment: 24-8月 -06)

8. The teacher said you have until the last day of this month to turn in your research paper. What day will this be? Name the output, "Deadline."

----select last_day(sysdate)as "Deadline"
from dual;
(Deadline: 28-2月 -06)

9. How many months between your birthday this year and January 1 next year?

----select months_between('27-MAY-06','01-JAN-07')
from dual;

10. What's the date of the next Friday after your birthday this year? Name the output, "First Friday."

----select next_day('27-MAY-06','friday')as"First Friday"
from dual;

5 Comments:

Blogger Henry Ruan said...

Look like you are doing well now. Is this something that you like to do?

2:22 PM  
Blogger Henry Ruan said...

Look like you are doing well now. Is this something that you like to do?

2:22 PM  
Blogger 大葱~~~~~~~ said...

maybe, i want to work harder and harder on my study, to be a good student,good good study, day day up,haha...

4:46 PM  
Blogger Ridhima said...


All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.


Java training in Adyar

7:49 AM  
Blogger Unknown said...


Nice it seems to be good post... It will get readers engagement on the article since readers engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
Android App Development Company

11:39 PM  

Post a Comment

<< Home