For the longest time I’ve had a hard time remembering the difference between SQL Server DDL vs DML statements. I had a hard time remembering what statement fell under what category. Was INSERT, UPDATE, DELETE a DML command or DDL? What about CREATE / ALTER? It was all confusing to me.
I finally figured out a way to remember the difference. Before I tell you my “secret”, here’s a quick explanation of each.
DDL, or Data Definition Language, consists of the following commands:
CREATE, ALTER and DROP
Below is an image taken straight from MSDN that includes all the DDL statements.
DML, or Data Manipulation Language, consists of the following commands:
INSERT, UPDATE, DELETE, SELECT…
Below is an image taken straight from MSDN.
How did I memorize the difference? Well, for DML the ‘M’ is for ‘manipulation’, so I automatically associate “INSERTING” or “UPDATING” data as “manipulating” data. Once I understood that, DDL became easy to remember and associated it with CREATE, ALTER, DROP. By memorizing one of them you automatically know the second. :)