Chapter 3. The GraphQL Query Language

Forty-five years before GraphQL was open sourced, an IBM employee, Edgar M. Codd, released a fairly brief paper with a very long name. “A Relational Model of Data for Large Shared Databanks” didn’t have a snappy title, but it contained some powerful ideas. It outlined a model for storing and manipulating data using tables. Soon after that, IBM began working on a relational database that could be queried using Structured English Query Language, or SEQUEL, which later became known only as SQL.

SQL, or Structured Query Language, is a domain-specific language used to access, manage, and manipulate data in a database. SQL introduced the idea of accessing multiple records with a single command. It also made it possible to access any record with any key, not just with an ID.

The commands that could be run with SQL were very streamlined: SELECT, INSERT, UPDATE, and DELETE. That’s all you can do to data. With SQL, we can write a single query that can return connected data across multiple data tables in a database.

This idea—that data can only be read, created, updated, or deleted—did make its way to Representational State Transfer (REST), which requires us to use different HTTP methods depending upon these four basic data operations: GET, POST, PUT, and DELETE. However, the only way to specify what type of data you want to read or change with REST is via endpoint URLs, not an actual query language.

GraphQL takes the ideas that were originally developed ...

Get Learning GraphQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.