Abaixo está uma instrução que descreve uma tarefa de geração de SQL, combinada com uma entrada que fornece mais contexto sobre os esquemas de tabela disponíveis. Escreva o código SQL que responda adequadamente à solicitação
 ###Instrução: Qual é o total de pontos marcados por cada equipe em uma temporada?
 ###Tabelas: 
CREATE TABLE Team (TeamID int, TeamName varchar(50), Points int); CREATE TABLE Match (MatchID int, HomeTeamID int, AwayTeamID int, HomeTeamPoints int, AwayTeamPoints int);  INSERT INTO Team (TeamID, TeamName, Points) VALUES (1, 'Barcelona', 0), (2, 'Real Madrid', 0); INSERT INTO Match (MatchID, HomeTeamID, AwayTeamID, HomeTeamPoints, AwayTeamPoints) VALUES (1, 1, 2, 3, 1), (2, 2, 1, 2, 2), (3, 1, 2, 1, 1), (4, 2, 1, 3, 0);
SELECT COALESCE(t.TeamName, ht.TeamName) AS TeamName, SUM(COALESCE(ht.Points, 0)) + SUM(COALESCE(at.Points, 0)) AS TotalPoints FROM Team t RIGHT JOIN ( SELECT HomeTeamID, HomeTeamPoints AS Points, TeamName FROM Team UNION ALL SELECT AwayTeamID, AwayTeamPoints, TeamName FROM Team ) ht ON t.TeamID = ht.HomeTeamID RIGHT JOIN ( SELECT HomeTeamID, AwayTeamPoints AS Points, TeamName FROM Team UNION ALL SELECT AwayTeamID, HomeTeamPoints, TeamName FROM Team ) at ON t.TeamID = at.AwayTeamID GROUP BY t.TeamID, t.TeamName;