I am new to sql and am trying to complete my first project
I have this query
SELECT Nationality, SUM(Kill
) AS total_kills_by_region
FROM vct2
WHERE Nationality = ‘United States’;
It selects the sum of total kills in a valorant championship where the player’s nationality is the united states. All of the nationality types are # Nationality
‘Argentina’
‘Belgium’
‘Brazil’
‘Canada’
‘Chile’
‘Finland’
‘France’
‘International’
‘Kazakhstan’
‘Latvia’
‘South Korea’
‘Sweeden’
‘Turkey’
‘Ukraine’
‘United Kingdom’
‘United States’
Do I have to just copy and paste this query over and over again to get the results for all of these?
I plan to compile a map in tableau with the results.
I am not sure exactly how to go about this.
Cody Copenhaver is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You are looking for GROUP BY
:
SELECT nationality, SUM(kill) AS total_kills_by_region
FROM vct2
GROUP BY nationality
ORDER BY nationality;