Recently, my attention was drawn to a question which is often asked. Here, I am going to explain why select is called DML (Data Manipulation Language).

First of all, do not confuse the word with "Manipulation". We are assuming “manipulation equals to insert, update and delete”. No guys, it is not true. We cannot say that the SELECT statements are used for only retrieving the data, it is used to manipulate the data.

The word “Manipulation” means to play with the data, not only retrieve or fetch the data. We can include retrieve, store, modify, delete, insert, update, and copy operations in DML.

As per SQL standard select is in DML list.
They mentioned that select is limited form of DML means select is DQL and select * into is DML. 

Data manipulation can be,

  1. Data aggregation
  2. Data Grouping
  3. Data Ordering like ascending or descending
  4. Performing mathematical operations
  5. Data conversion or type conversion
  6. Pattern matching with regex
  7. Condition retrieving of data
  8. Working with CTE

Other than the above list, there are many other operations which can be included in the DML list.

Let me explain how a SELECT statement can change the data of database tables...

Example 1 (DML)
  1. SELECT * INTO tb_Table2 FROM tb_Table1

The above statement will copy all the records and columns from tb_Table1 to tb_Table2. It is a kind of manipulation.

Example 2 (DQL)
  2. SELECT @str = CONCAT(@str, StudentID, ','FROM Students  
  3. SELECT @str AS CommaSaperatedStudentIDs  
This query will fetch and append all the comma separated StudentIDs in @str variable. We did string manipulation.
That's it. We learned why SELECT is called DML statement in SQL. Comment for reporting any mistake, change, or your valuable suggestions.
Thanks for reading. Keep Learning - Keep Writing.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now