views:

80

answers:

5

I understand that DML technically encompasses SQL verbs which merely query but do not modify persistent data. (See, e.g., wikipedia or oracle or orafaq)

However, I often wish to refer to "all and only those SQL verbs which modify stored/persistent data" -- basically INSERT, UPDATE, DELETE but not a plain SELECT. Is there an official/standardized term, or, perhaps separately, a cogent and graceful term, for this subset of DML?

A: 

My professor used to define them as Edits (as opposed to Reads), but I do not know of a Standard Term for IUD.

Raj More
A: 

based on CRUD: Create, read, update and delete, you could just say CUD (create, update, delete). however, I'm not sure if anyone uses that.

KM
A: 

I don't think there is one, sadly, from an official perspective. Perhaps we need to make one up?

Personally, I think the term DML is misleading because the term doesn't really describe the way SELECT works, as it (usually) doesn't actually modify anything. It only "collects" the relational data in a different fashion in temporary space and returns a specified set of it.

So, if it was my choice, I would say that:

DML would describe INSERT/UPDATE/DELETE

and

DRL (data retrieval language) would describe SELECT.

sheepsimulator
Accepted. While I think we'd argue ad infinitum about new terminology, I think the thrust of your answer is dead on.
pilcrow
Maybe we could all just agree that DML means "Data Manipulation Language" (as opposed to DDL, which is still "Data Definition Language"). :)
Ian Varley
+2  A: 

DML includes SELECT INTO (as opposed to just SELECT) because it is a synonym for INSERTs. There's no need to subcategorize.

After thinking about it on the way into work, I remembered that SELECT is used for data manipulation. For example:

SELECT t.firstname +' '+ t.lastname --String concatenation
SELECT CAST(t.column AS int) --Datatype change
OMG Ponies
Ahh... that's a possibility.
sheepsimulator
Yes, DML is the term you're looking for.
Rob H
Yes and clever, but a plain SELECT can only transform data in ephemeral projections, it cannot modify the stored or persistent data, which is the intent behind my question. I'll clarify.
pilcrow
@pilcrow: Modification implies persistence, but there are cases where persistence isn't required - the need is temporary. But it is still data manipulation.
OMG Ponies
A: 

According to the Wikipedia article on SQL,

The Data Manipulation Language (DML) is the subset of SQL used to add, update and delete data:

and the statements discussed there (INSERT, UPDATE, DELETE, MERGE, TRUNCATE, etc) are placed in a different category than SELECT.

So, according to Wikipedia, DML may not necessarily include SELECT.


According to the SQL-92 standard, glancing at the table-of-contents reveals that DML does include SELECT INTO:

     13 Data manipulation ............................................371

     (...)

     13.5 <select statement: single row> .............................382

     (...)

The definition listed there describes SELECT <columns> INTO ... .

sheepsimulator