The languages of a DBMS depend on the kind of database, but for relational systems the answer starts with SQL. SQL commands fall into groups by purpose, and most products add extensions of their own. Non-relational databases often use query languages that aren’t SQL at all.
The four SQL command groups
- DDL defines structure, with commands such as CREATE, ALTER and DROP.
- DML works with rows, with commands such as INSERT, UPDATE and DELETE. Many systems also support MERGE.
- DCL controls permissions, with GRANT and REVOKE.
- TCL manages transactions, with COMMIT, ROLLBACK and SAVEPOINT.
Some textbooks also name DQL for SELECT. The dbms languages list goes deeper into each group, with examples and the places where the groups get blurry.
Extensions from each product
Many products also add a procedural language with variables, loops and stored procedures. Common examples are:
- T-SQL in Microsoft SQL Server
- PL/SQL in Oracle Database
- PL/pgSQL in PostgreSQL
Code written for one of these often needs changes before it runs on another.
Query languages outside SQL
- MongoDB uses a JSON-style query syntax.
- Neo4j uses Cypher for graph data.
- Many RDF triple stores use SPARQL.
These languages have their own commands, so the SQL groups don’t apply to them directly.
Where to start
Learn SELECT, INSERT, UPDATE and DELETE on a small test database first. Then add CREATE TABLE and transaction commands.