The SQL language served as a universal language for database manipulation from the mid-1980s until NoSQL databases started gaining strength about 12 years ago. However, after a short period in the wilderness, SQL is back and possibly more vital than ever.
SQL emerged from the relational model defined by Edgar Codd back in 1970, though SQL itself was not a part of that model. Codd argued for a “database sublanguage” to navigate and modify relational data, though his proposed language, “Alpha,” never took off. However, Alpha influenced the QUEL language used by the creators of Ingres—an early relational database system developed at the University of California, which influenced the open source PostgreSQL database.
Meanwhile, researchers at IBM were developing System R, a prototype DBMS based on Codd’s relational model. They created the SEQUEL language as the data sublanguage for the project. SEQUEL eventually was renamed SQL and was rapidly adopted by commercial databases such as Oracle and IBM’s Db2. By the end of the 1970s, SQL had won out over QUEL as the relational query language and became an ANSI (American National Standards Institute) standard language in 1986.
The relative ease of use that SQL provided expanded the audience of database users dramatically. You no longer needed to be a highly experienced database programmer to retrieve data from a database; SQL could be taught to casual users of databases, such as analysts and statisticians. It’s fair to say that SQL brought databases within reach of business users.
However, when the “NoSQL” database movement emerged in the late-2010s, SQL became associated with yesterday’s databases. New databases, such as MongoDB and Cassandra, provided only token support for SQL, and developers, in general, seemed to prefer non-SQL programming models.
But, the power and ubiquity of SQL were not easy to dismiss, and, increasingly, NoSQL databases came under pressure to add significant SQL support. Furthermore, new database systems emerged that combined the strengths of SQL and the relational model with the best ideas from NoSQL.
For instance, Snowflake provides rich SQL support with the ability to process unstructured data, which previously had been a sweet spot for Hadoop. CockroachDB combines the power of SQL and strong consistency with the elastic scalability that is often associated with NoSQL databases such as Cassandra and DynamoDB.
However, even though SQL is here to stay, a few alternatives are lurking in the wings. Graph query languages, such as Gremlin and Cypher, offer a more productive language for issuing queries against graph structures. SQL is notoriously unwieldy for these sorts of queries and, despite attempts to add graph operators, probably will never be a match for these graph-specific languages.
Pipelined Relational Query Language (PRQL, pronounced “Prequel”) is an interesting variation on a SQL-equivalent language. Similar to Hadoop’s PIG language, it represents operations as a pipeline of transformations. This can result in less repetition and improved readability. It also gives the programmer more control over the sequence of execution.
GraphQL is more of a means for implementing API endpoints and, as such, competes more naturally with REST than with SQL. But it does allow programmers to construct queries against back-end data sources, typically for manipulating JSON structures. It represents an alternative to SQL when creating APIs that offer query services.
Stronger Than Ever
SQL is one of the most long-lived programming languages and, by almost any measure, immensely successful. Having survived a recent assassination attempt, SQL has emerged stronger than ever.