When working with Gatsby, you access your data through a query language called GraphQL. It allows you to express your data needs. With so-called queries, you can represent the data you need. As an example:

{
  person {
    name
  }
}
GraphQl Query
{
  "data": {
    "person": {
      "name": "Mr. Gatsby"
    }
  }
}
Output of query

Furthermore, you can add parameters like filtering, sorting, and much more.

{
  dog(id: "1000") {
    name
    height(unit: meters)
  }
}
GraphQl query with parameters
{
  "data": {
    "dog": {
      "name": "Bella",
      "height": 1.1
    }
  }
}
Output of query with parameters

But what if you want to query for the same field with different arguments? For that, you need aliases - they let you rename the result of a field to anything you want.

{
  female: dog(gender: female) {
    name
  }
  
  male: dog(gender: male) {
    name
  }
}
twice the same GraphQl query but with different arguments
{
  "data": {
    "female": {
      "name": "Bella"
    }
    "male": {
      "name": "Bello"
    }
  }
}
Output of those queries

In the above example, the two hero fields would have conflicted, but since we can alias them to different names, we can get both results in one request.

Hope you enjoyed this brief blog post. If you want to know more about how to use GraphQl, I recommend checking out their docs.