- SQL, DDL and DML — the big picture
One language (SQL) does two jobs: define the structure, then work with the data.
A Database Management System (DBMS) is the software that sits between users (and programs) and the actual stored data. To talk to it we use SQL (Structured Query Language) — the industry standard for relational databases. SQL has two halves, doing two very different jobs:
| Part | Job | Typical commands |
|---|---|---|
| DDL — Data Definition Language | Create and modify the structure of the database (tables, fields, data types, keys) | CREATE DATABASE, CREATE TABLE, ALTER TABLE |
| DML — Data Manipulation Language | Query and maintain the data held in the tables | SELECT, INSERT INTO, UPDATE, DELETE |
A simple way to remember it: DDL builds the empty filing cabinet and labels the drawers; DML puts paper in, reads it, edits it and throws it away. Both are written in SQL, but only DDL changes the shape of the database.
- SQL is the industry standard for relational databases.
- DDL = define/modify structure (CREATE, ALTER).
- DML = query and maintain data (SELECT, INSERT, UPDATE, DELETE).
- Both are SQL; only DDL changes the table structure.