What is a query language? How is it different from a programming language? Why do there seem to be so many of them.
How are databases and query languages related?
What kind of developer needs to know query languages?
A query language is a Domain Specific Language (DSL) built to interact with some kind of data storage system.
But wait, what's a domain specific language? This is a kind of special programming language meant for a specific domain, or another way of putting it is that it has a narrow purpose. Compare this to a so-called "General Purpose Programming Language" like Python, C++ or Java.
These domain specific languages pop up everywhere in software engineering and query languages, specifically SQL (structured query language) is one of them.
There are also domain specific languages used to display data (templating languages) or specifically to display text (markup languages). I am actually writing this blog post in a DSL called "Markdown", which is meant to display text.
As I mentioned, a query language is a DSL built interact with a data storage system.
SQL is the one you have probably heard of, it was developed by IBM in 70's so it's been around a long time. There is a standard form of SQL (defined by ANSI, and ISO - standards organizations) but in many cases specific database software will implement and extend this standard SQL form.
SQL in particular is meant to work with relational databases (which are at this point the most common type of database). MySQL, Postgres, MSSQL and Oracle all are relational databases that use SQL.
It's safe to say that every relational database using SQL has its own slightly different version of SQL but in general they are the same language for the most part.
SQL allows a user to retrieve data from the database, do computations of data to produce reports, insert and update data, and usually some way to manage the database system itself.
NoSQL (or non-relational) database systems are all over the map in terms of what query languages they use. In many cases a NoSQL database is using it's own custom query language and is not following some standard like the ANSI SQL Specification.
MongoDB for example does not support SQL but does have "rich query language of it's own".
Neo4J (a graph database) has it's own language Cypher and is actually in the process of creating a formal standard around this language.
Having used both of these I can tell you that MongoDB's query language and Cypher are both drastically different from each other. And both of these are quite different from SQL.
So for NoSQL database, you can expect they come with their own custom query language that only works with that database.
The point of me explaining these differences is twofold: one, I want to demonstrate that you can probably categorize query languages into two camps. SQL based, and everything else. Secondly, I want to make the point that every database has some sort of query language.
The query language is the gateway to the data stored within a database. This goes for both creating and reading data. You can't really use a database effectively without using a query language to talk to it.
Well, if you think about application architecture there is usually a division between frontend developers and backend developers. The backend developers are typically writing the server side code that will interface with the the database.
So your backend developers on a project are actually going to need to know the query language for the corresponding database they are using to store and retrieve information for the application they are building.
Additionally you might have a devops person managing backups, or a data analyst running queries to crunch data and derive metrics about application usage. Many people may want access to the database and to effectively use the data they need to learn the query language for the given database.
Query Languages are special languages (DSLs) that are meant to interact with datastores (like relational databases).
They pretty much fall into SQL based or a something else category.
Backend developers need to know the query language for the database they are building an application on top of.