Basic queries in GraphQL

From the GraphQL cheat sheet · Queries · verified Jul 2026

Basic queries

graphql
# Simple query
query {
  hello
}

# Query with fields selection
query {
  users {
    id
    name
    email
  }
}

# Query with arguments
query {
  user(id: "123") {
    name
    email
    age
  }
}

# Nested queries
query {
  user(id: "123") {
    id
    name
    posts {
      id
      title
      comments {
        id
        content
        author {
          name
        }
      }
    }
  }
}
💡 Request exactly what you need
⚡ Single request for nested data
📌 No over-fetching or under-fetching
🟢 Predictable results matching query shape

More GraphQL tasks

Back to the full GraphQL cheat sheet