question

Steve Jones - Editor avatar image
Steve Jones - Editor asked

What is DML in T-SQL?

I see lots of articles that use the term DML. What exactly does this mean and what are examples of it? Are all T-SQL statements DML?

t-sqldml
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jack Corbett avatar image
Jack Corbett answered

DML stands for Data Manipulation Language so any statement that manipulates data would be DML, like SELECT, INSERT, UPDATE, DELETE, and MERGE.

Another type of T-SQL statements are DDL (Data Definition Language) and this is where you define the structures for your data like CREATE, ALTER, DROP.

A third type would be Access Control which would be things like GRANT, REVOKE, DENY. I don't think these fit in DML or DDL.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Whitfield avatar image
Matt Whitfield answered

DML stands for 'Data Manipulation Language' and covers all T-SQL statements that retrieve, store or modify data.

DDL is the other main category, and stands for 'Data Definition Language'. This covers T-SQL statements that modify objects in the schema.

Edit -> thought i should mention the other categories, as Jack did.

You have DCL - 'Data Control Language' - which as Jack says is to do with data security.

Then you have TCL - 'Transaction Control Language' - which are statements to do with opening and closing transactions.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.