Q:

Sql query to count ads added in the last 7 days

I have made this working sql query to count the ads the user has in total ->
SELECT count(*) FROM `table_name` WHERE `user_id` = 20;

So this shows how many ads the user has in total.  What I want to add is how many ads the user added in the last 7 days... so I have a column in table_name called "created_date"... so can somebody please help me how to count the user ads by "created_date" from now to last 7 days please? 
Thank you

A:

SELECT COUNT(*)
FROM   table_name
WHERE  user_id = 20 AND created_date > NOW() - INTERVAL 7 DAY

More generally, look at MySQL's date functions for all sorts of advanced date handling.