Knowing the geographic distribution of your user base guides internationalization (i18n) priorities — which languages to support next, which payment methods to add, and where to invest in infrastructure. Product managers run this query before planning cycles to validate whether to expand into new markets or deepen investment in existing ones. Using the users table, return country and user_count, ordered by user_count descending, then country ascending for ties.
users
| column | type |
|---|---|
| id | INTEGER |
| name | TEXT |
| TEXT | |
| country | TEXT |
| created_at | DATE |
| id | name | country | created_at | |
|---|---|---|---|---|
| 1 | Alice | alice@example.com | US | 2024-01-01 |
| 2 | Bob | bob@example.com | US | 2024-01-02 |
| 3 | Carol | carol@example.com | UK | 2024-01-03 |
| 4 | Dave | dave@example.com | CA | 2024-01-04 |
| 5 | Eve | eve@example.com | US | 2024-01-05 |
| country | user_count |
|---|---|
| US | 3 |
| CA | 1 |
| UK | 1 |
US has three users — the most of any country. CA and UK each have one user and are tied, so they appear in alphabetical order (CA before UK) due to the secondary ORDER BY country ASC.