Question : SQL

Have to do this and a few other querys for an assignment and cannot figure them out.
Here is the assignment:
Using the BOOK_ORDER table, create a query using the correct function to return
 the order#, the date ordered, the date shipped, and a column representing the number
 of months between the two dates for all columns where a date shipped exists.
 Round the number returned from the function to two decimals, and give the column an
 alias of “Months Between”.  

NOTE: Be sure that all of the numbers in the fourth column are positive numbers.

Answer : SQL

SELECT ORDER#, ORDERDATE, SHIPDATE,
ROUND(MONTHS_BETWEEN(SHIPDATE,ORDERDATE),2) AS "Months Between"
FROM BOOK_ORDER WHERE SHIPDATE IS NOT NULL;

MONTHS_BETWEEN function is described more here...
http://www.psoug.org/snippet/Months_Between_function_201.htm
Random Solutions  
 
programming4us programming4us