SQL Statement Categories

Since you’re reading this blog post, you’re probably used to running different types of SQL statements. Do you ever stop to consider what category those statements fall into? Maybe you’ve heard the acronyms DML and DDL tossed around but don’t know what those mean. Maybe you’re not familiar with the acronyms DCL and TCL.

Let’s get back to the basics and review SQL statement categories.

DML Statements

DML stands for Data Manipulation Language. I’d wager to guess anyone that’s logged onto a SQL Server has at least used a SELECT statement which falls into this category. When you consider “manipulation” it makes sense that other statements in this category are UPDATE, DELETE, and INSERT. If you’re retrieving or making changes to records in your database, chances are you’re using DML statements.

DDL Statements

Moving up a level, DDL stands for Data Definition Language. DDL statements are working with the data structure. Rather than changing individual records within a table which would be more common with a DML statement, DDL statements could be used to perform broader table tasks such as CREATE, DROP, or TRUNCATE.

DCL Statements

A category one may tend to forget is DCL which stands for Data Control Language. As the name implies, this category is about controlling access and user permission. The GRANT, DENY, and REVOKE statements fall into the DCL category.

TCL Statements

TCL stands for Transaction Control Language. If you’ve ever been changing data and wanted a bit of a safety net in case your results didn’t match what you expected, you’re probably familiar with TCL statements. BEGIN TRAN, ROLLBACK TRAN, and COMMIT TRAN are statements for this category.

Brilliant at the Basics

If you didn’t know these categories and their statements, now you have some highlights of each to reference. DML and DDL tend to be pretty easy to remember. If you remember the “C” is for control in DCL and the “T” is for transaction in TCL then those are pretty easy to figure out as well.

Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s