[sql] How to query for today's date and 7 days before data?

I'm using sql server 2008. How to query out a data which is the date is today and 7 days before today ?

This question is related to sql

The answer is


Query in Parado's answer is correct, if you want to use MySql too instead GETDATE() you must use (because you've tagged this question with Sql server and Mysql):

select * from tab
where DateCol between adddate(now(),-7) and now() 

Try this way:

select * from tab
where DateCol between DateAdd(DD,-7,GETDATE() ) and GETDATE()