How do i count all Wordpress posts released inside a certain year(for eg. 2010) from the database using SQL?
PS: I handled to get it done while using Wordpress Api query_posts() function, however i would like the sql query for this.
SELECT COUNT(*) AS PostCount FROM PostTable WHERE PostDate BETWEEN '2010-01-01' AND '2011-01-01'
Presuming you are looking at the released posts:
SELECT COUNT(*) FROM wp_posts WHERE YEAR(post_date) = 2010 AND post_type = 'post' AND post_status = 'publish'
wp_posts may be the default posts table title, adjust with whatever prefix you're considering should you transformed it.