Pulled out sql statements from main spec