SQL for fun and profit