The STORES table has a column START_DATE of data type DATE, containing the date the row was inserted.
You only want to display details of rows where START_DATE is within the last 25 months.
Which WHERE clause can be used?
The STORES table has a column START_DATE of data type DATE, containing the date the row was inserted.
You only want to display details of rows where START_DATE is within the last 25 months.
Which WHERE clause can be used?
To determine if the START_DATE is within the last 25 months, we can use the MONTHS_BETWEEN function which returns the number of months between two dates. Since we are interested in rows where the START_DATE is within the last 25 months from the current date, we should calculate the number of months between the current date (SYSDATE) and the START_DATE, ensuring this value is less than or equal to 25. Therefore, the appropriate condition is MONTHS_BETWEEN(SYSDATE, start_date) <= 25.
C is correct
C is true. MONTHS_BETWEEN(date 1, date 2) Oracle gives a positive value when date 1 > date 2 and a negative when date 1 < date 2 https://www.techonthenet.com/oracle/functions/months_between.php
c is the answer using ADD_MONTHS(date, n)
START_DATE stores "the date the row was inserted". Therefore cannot be > SYSDATE (that is "now") and C is the right one
I can't get why the B is incorrect. A negative value is still less than 25. I think I have to check it in DB.
The statement in B would indeed result in -25 and thus be correct. But C is the 'cleaner' answer here and thus the one you should pick.
The question has been edited and this is no longer an option!
"A negative value is still less than 25." Yes, but -30 (meaning 30 months ago) would be less than 25.
D is false, only put an example between '01/01/200' and '01/02/2002' 25 months but isn't in the last 25 months
why D is not true ?
It would work as well,
Because.....less than 25 months,ex:ˇ26.27.28.29.30 month?
if start_date+25 is less than sysdate, then start_date is not in the last 25 months