How to learn to query the block chain? I want to find out how many addresses have had x transactions over time. 

I want to find out the average bitcoin transaction size for  over time...I want to do a bunch of different queries like that on a regular basis.

Big picture: I want to do fundamental research on block chain activity and publish it. I have worked a decent bit with databases in the past. How can I learn to interact proficiently with the bitcoin blockchain?
One could extract the Blockchain and import it to your own database for analysis.  For example, see project: bitcoin-to-neo4j.