Simple SQL Queries for Blog Stats

Nick asks how I got the stats I posted. Nothing special or fancy, I just ran a couple of simple SQL queries. I figured some of you might want to run them as well, so here they are:

Total # of posts in 2006:

SELECT COUNT(*)
FROM `wp_posts`
WHERE post_date >= '2006-01-01'
AND post_date < '2007-01-01' AND post_status = 'publish'

Total # of comments in 2006:

SELECT COUNT(*)
FROM `wp_comments`
WHERE comment_date >= '2006-01-01'
AND comment_date < '2007-01-01' AND comment_approved = '1'

Average length of posts in 2006:

SELECT AVG(LENGTH(post_content))
FROM `wp_posts`
WHERE post_date >= '2006-01-01'
AND post_date < '2007-01-01' AND post_status = 'publish'

Total length of all posts in 2006:

SELECT SUM(LENGTH(post_content))
FROM `wp_posts`
WHERE post_date >= '2006-01-01'
AND post_date < '2007-01-01' AND post_status = 'publish'

Note: These all assume the standard 'wp_' prefix for your database tables.