I have a table named studios with the columns "earnings" and "country". Each item of that table describes a studio in a country and its earnings.
How can I select the average earnings of the studios for each country?
SELECT AVG(earnings) --I want per country
FROM studios
SELECT country,AVG(earnings) FROM studios GROUP BY country;
You can do that: "SELECT AVG(earnings) FROM studios GROUP BY country"
If you have column country_id is for prefer.
You can use and this query "SELECT AVG(earnings),country FROM studios GROUP BY country"
你可以用这个:
SELECT AVG(earnings) , country from studios group by country
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.