If you are looking for an SQL generator that can handle common analytical questions, I recommend www.mitzu.io. (i am the founder)
It is like Mixpanel + Chartmogul combined in a single tool, but it autogenerates SQL data on top of your "event tables".