Quantas Goal Difference tem menos de 9 derrotas, e 8 empates, e mais de 40 pontos?
CREATE TABLE table_name_22 (goal_difference INTEGER, points VARCHAR, losses VARCHAR, draws VARCHAR)
SELECT SUM(goal_difference) FROM table_name_22 WHERE losses < 9 AND draws = 8 AND points > 40