Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

SQL DDL, DML, DCL and TCL: What Each Does and When to Use It

DDL changes database structure, DML works with table rows, DCL manages privileges, and TCL controls transactions. See what each means in PostgreSQL 17 and why behavior can vary across databases.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DDL changes database structures, DML changes the rows stored in them, DCL manages access privileges, and TCL controls whether a group of changes is committed or undone. These four labels are a useful way to learn SQL, but they are not a guarantee that every database product classifies or handles every command identically. The examples below use PostgreSQL 17; check the documentation for your own database and version before relying on particular syntax or behavior.

What do DDL, DML, DCL and TCL mean?

The labels describe the main job a SQL statement performs:

As an Amazon Associate I earn from qualifying purchases.

Category What it acts on Typical commands Practical effect
DDL: Data Definition Language Database structures and objects CREATE TABLE, ALTER TABLE, DROP TABLE Creates, changes or removes an object.
DML: Data Manipulation Language Rows stored in tables INSERT, UPDATE, DELETE Adds, changes or removes table data.
DCL: Data Control Language Privileges on database objects GRANT, REVOKE Assigns or removes permissions.
TCL: Transaction Control Language The state of a transaction BEGIN, COMMIT, ROLLBACK Starts, commits or aborts a related set of work.

A teaching analogy is to think of a database table as a container: DDL changes the container, DML works with its contents, DCL manages who may use it, and TCL decides whether related changes are kept or undone. This is only a learning aid, not a formal definition of SQL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PostgreSQL describes its SQL command reference this way: “This part contains reference information for the SQL commands supported by PostgreSQL.” Its command index documents commands individually, rather than promising one universal set of category boundaries.

DDL: define or change database structure

Data Definition Language concerns the objects that organize a database, such as tables. In PostgreSQL, CREATE TABLE establishes a table, ALTER TABLE changes one, and DROP TABLE removes one. These commands affect the structure, rather than simply adding or editing a row.

CREATE TABLE orders (
    order_id integer,
    customer_name text,
    total numeric
);

This example creates an orders table with three columns. The PostgreSQL command reference lists CREATE TABLE, ALTER TABLE and DROP TABLE as commands for defining, changing and removing database objects.

DML: work with the rows in a table

Data Manipulation Language operates on the data held in tables. INSERT adds rows, UPDATE changes existing rows, and DELETE removes rows. PostgreSQL’s novice-oriented SQL tutorial groups insertion, updating and deletion in its data manipulation material.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
INSERT INTO orders (order_id, customer_name, total)
VALUES (101, 'Mina', 42.50);

This inserts one illustrative order row; it does not create the table itself. The PostgreSQL command index provides individual entries for INSERT, UPDATE and DELETE.

DCL: assign or remove access privileges

Data Control Language is commonly used to describe statements that manage access. In PostgreSQL, GRANT assigns privileges and REVOKE removes them. For example, a grant can allow a role named analyst to read from the orders table:

GRANT SELECT ON orders TO analyst;

The exact privileges available depend on the object type. PostgreSQL also distinguishes ownership rights from ordinary grantable privileges: owning an object is not the same thing as receiving a routine grant. Its privileges documentation explains ownership, privilege assignment and the use of GRANT and REVOKE.

TCL: control whether a transaction’s work is kept

Transaction Control Language is a teaching label for commands that manage a transaction. A transaction groups work so that it can be committed or aborted. In PostgreSQL, BEGIN (also expressible as START TRANSACTION) starts a transaction, COMMIT commits the current one, and ROLLBACK aborts it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
BEGIN;
INSERT INTO orders (order_id, customer_name, total)
VALUES (102, 'Lee', 18.00);
COMMIT;

Here, COMMIT ends the transaction by committing its work. To abort the current transaction instead, use ROLLBACK rather than COMMIT. PostgreSQL’s command reference lists transaction commands and their roles. Whether a particular statement can be used inside a transaction, and what happens when it is, can depend on the database and context.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How the categories fit together in an orders example

A simple sequence shows why the categories are not interchangeable:

  1. Define the table: use DDL such as CREATE TABLE orders (...) to establish its structure.
  2. Add an order: use DML such as INSERT INTO orders ... to add a row.
  3. Allow a role to read it: use DCL such as GRANT SELECT ON orders TO analyst; to assign a privilege.
  4. Control a group of changes: use TCL such as BEGIN and COMMIT to commit a transaction, or ROLLBACK to abort the current transaction.

The examples illustrate PostgreSQL command roles; syntax, privilege rules and transaction behavior depend on the database system and context. PostgreSQL’s SQL command index links to command-specific descriptions, while its privileges guide covers access rules.

Are these categories universal across SQL databases?

No. DDL, DML, DCL and TCL are common teaching labels, but they should not be treated as a cross-database contract about how every statement is grouped or behaves. PostgreSQL’s command reference directs readers to individual command pages for information about standards conformance and compatibility. For an unfamiliar command, consult the documentation for the database product and version you actually use, especially when transaction behavior or category boundaries matter.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where to learn the commands next

PostgreSQL’s SQL language guide is organized for novice readers and connects introductory material with more detailed documentation. Its SQL Commands reference is the place to check individual command descriptions, compatibility and standards conformance. If you use a different database, follow that product’s documentation and version instead of assuming the PostgreSQL examples transfer unchanged.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.