With Everbase, you can access a dataset of the world's countries over a GraphQL API.
Do you know how many cities have a population of more than 200 million people? Let's find out:
{
countries(where: {population: {gt: 200000000}}) {
name
population
}
}
{
"data": {
"countries": [
{
"name": "Brazil",
"population": 210147125
},
{
"name": "India",
"population": 1326093247
},
{
"name": "Indonesia",
"population": 263991379
},
{
"name": "People's Republic of China",
"population": 1409517397
},
{
"name": "United States of America",
"population": 325145963
}
]
}
}
In the query above, we used gt
to find countries with a population greater than a number. We can use lt
to do the opposite.
{
countries(where: {population: {lt: 20000}}) {
name
population
}
}
{
"data": {
"countries": [
{
"name": "Nauru",
"population": 13650
},
{
"name": "Tuvalu",
"population": 11192
}
]
}
}
Yes, there are two countries with a population of less than 20 thousand. Both are extremely remote islands in
the pacific. Fun fact: Did you know the .tv
domain is actually the belongs to Tuvalu? Being such a
tiny nation, a lot of its income comes from renting out the domain name.
Countries are also accessible via other types. Continents:
{
continents(where: {name: {eq: "Europe"}}) {
countries {
name
}
}
}
Or IP geolocation:
{
client {
ipAddress {
country {
name
}
}
}
}
Want to know more about countries and the fields you can access on them? Check the Country reference. To try your own queries, use the editor.