mysql between condition I am trying to understand a portion of a query i am looking at. it was written elsewhere. 

between now() - interval 30 day and now();

Does this mean between now and 30 days above (returns data between now and one month in advance or does it mean between now and one month prior? 

The problems i am having to understand are:


Why is there a minus sign instead of an AND after between? Unless the and condition is (between now-interval 30 day AND now).
If so, does the minus sign incinuate back 30 days?
Parenthesis will probably help:

col BETWEEN (now() - interval 30 day) AND now()


now() - interval 30 day means "30 days ago" - the whole expression is "between 30 days ago and now". Actually, unless you have values higher than current datetime, you can simply use:

col &gt;= NOW() - interval 30 day


This page is a good explanation of the INTERVAL syntax. MySQL documentation about time and date functions DATE_ADD() and DATE_SUB() explains the syntax as well: Date and time functions.

now() - interval 30 day is equivalent to date_sub(now(), interval 30 day), so you could also write the condition like this:

col BETWEEN date_sub(now(), interval 30 day) AND now()


Note that NOW() - interval 30 day means 30 days ago at this exact time, because NOW() returns a DATETIME value.