What is SQL?
SQL is the language for asking questions of relational databases. Learn what it is, why every major database speaks a dialect of it, and how it differs from NoSQL.
SQL (Structured Query Language) is the standard language for storing, retrieving and manipulating data in relational databases. Instead of telling the computer *how* to find your data step by step, you describe *what* you want and the database engine figures out the rest.
Almost every serious relational database — PostgreSQL, MySQL, MariaDB, Microsoft SQL Server, Oracle Database and IBM Db2 — speaks SQL. There is an ANSI/ISO standard, but each vendor adds its own extensions and quirks. That is exactly why this guide shows every example across databases side by side.
Your first query
A query is just a request for data. The one below asks for every column of every row in a table called employees. It is identical across all six relational databases we cover.
The same query, everywhere
Return all rows from a table
SELECT * means "select all columns". The syntax is standardised, so this runs unchanged on every relational engine.
SELECT * FROM employees;SELECT * FROM employees;SELECT * FROM employees;SELECT * FROM employees;SELECT * FROM employees;SELECT * FROM employees;No direct equivalent
This database does not support this feature with the same syntax. See the notes for alternatives.
Where does NoSQL fit in?
Not every database is relational. Document databases like MongoDB store flexible, JSON-like documents instead of rows and columns, and they are queried with methods rather than SQL statements.
Throughout this guide, whenever a relational concept has a natural document-database counterpart, we show the MongoDB translation so you can move between the two worlds.
From SQL to MongoDB
"Give me every employee"
SQL (relational)
SELECT * FROM employees;MongoDB (document)
db.employees.find({});A table becomes a collection, a row becomes a document, and SELECT * with no filter becomes find({}) — an empty filter that matches everything.