refactor ale_db.sql
complete logic and helper fns in team section