Q4: What are the three root operation types in GraphQL?

Difficulty:EasyTopic:Operations

GraphQL supports three primary root operations:

  1. Query: Read-only fetches (analogous to HTTP GET).
  2. Mutation: Write operations that create, update, or delete data (analogous to POST/PUT/DELETE).
  3. Subscription: Event-driven real-time updates maintained over long-lived transport (e.g., WebSockets).
Key Takeaways
  • Queries are read-only, Mutations perform writes, and Subscriptions stream real-time events.
Knowledge Check

Which root operation should be used to modify data in a database?