created ranked teams sql statements and ranked the teams