iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
DDL defines or changes a database’s structure; DML adds, changes, or removes the data stored in that structure. Think of DDL as designing a room and its shelves, and DML as putting items on those shelves, rearranging them, or taking them away. It is a useful beginner’s analogy—not a formal definition of every SQL command.
What DDL changes
DDL stands for data definition language. Its commands define database objects or change their structure: the room and shelves in the analogy. PostgreSQL presents data definition separately from data manipulation in its documentation (PostgreSQL 18: Data Definition).
CREATE TABLEdefines a table.ALTER TABLEchanges a table’s definition.DROP TABLEremoves a table.
PostgreSQL’s command reference describes CREATE as defining objects, ALTER as changing definitions, and DROP as removing objects (PostgreSQL 18: SQL Commands).
What DML changes
DML means data manipulation language. These commands work with the data in tables—the contents of the room—rather than defining the table itself. PostgreSQL documents data manipulation separately from data definition (PostgreSQL 16: Data Manipulation).
#1 Best Overall
INSERTadds rows. PostgreSQL’s insertion documentation demonstrates adding data to aproductstable (PostgreSQL 16: Inserting Data).UPDATEchanges existing rows.DELETEremoves rows.
For example, a table definition might establish that a products table exists; an INSERT then adds a product row to it. Updating or deleting rows changes the table’s contents, not the table definition.
DDL and DML compared
| Aspect | DDL | DML |
|---|---|---|
| What it changes | Database structure or object definitions | Data stored in table rows |
| Examples | CREATE, ALTER, DROP |
INSERT, UPDATE, DELETE |
| Room analogy | Designing, changing, or removing the room or its shelves | Adding, changing, or removing the items on the shelves |
Not every SQL command fits this comparison
DDL and DML are useful labels for these command families, not a complete inventory or an exhaustive classification of SQL. PostgreSQL’s command reference also includes SELECT, transaction controls such as COMMIT and ROLLBACK, access-control statements, and other commands (PostgreSQL 18: SQL Commands). The room analogy helps explain the distinction, but it should not be used to force every SQL statement into one of these two categories.
Rank #2
Why a command might not run
Transaction mode
In PostgreSQL, transaction mode can restrict commands. Its read-only transaction documentation says specified data-changing statements—including INSERT, UPDATE, and DELETE—and structure-changing statements—including CREATE, ALTER, and DROP—are disallowed, subject to documented exceptions (PostgreSQL 18: SET TRANSACTION). This describes PostgreSQL behavior; rules may differ in other database systems.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Permissions
Command category and authorization are separate questions: knowing the syntax does not grant permission to use it. PostgreSQL has distinct privileges, including SELECT, INSERT, UPDATE, DELETE, and CREATE, with the applicable privilege depending on the object (PostgreSQL 16: Privileges).
Quick Recap
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

