Select 5 thousand rows from a table

0

I have a table with more than 5 thousand lines, where I have a column with year, municipal_names and another with values. I can get an average with a municipality that is represented in a row, but I wanted to do it all at once. They are all Brazilian municipalities. Is there any way? This is the code I'm using, but with this code, I can only do it one at a time.

SELECT nome, AVG(cota_fpm)
FROM economia
where nome = 'Alta Floresta D''Oeste';
    
asked by anonymous 18.04.2018 / 05:13

1 answer

2

Just group the result by the names of the municipalities using group by .

Try this query :

SELECT nome, AVG(cota_fpm)
FROM economia
GROUP BY nome;
    
18.04.2018 / 07:03