Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why 'Select' is called as DML statement ?

I see lot of debate of 'Select' being called as DML. Can some one explain me why its DML as its not manipulating any data on schema? As its puts locks on table should this be DML?

*In Wikipedia * I can see

"The purely read-only SELECT query statement is classed with the 'SQL-data' statements[2] and so is considered by the standard to be outside of DML. The SELECT ... INTO form is considered to be DML because it manipulates (i.e. modifies) data. In common practice though, this distinction is not made and SELECT is widely considered to be part of DML.[3]"

But in SELECT * FROM INSERT select will just perform selection nothing other than this!! Please someone help me in understanding this concept.

Thanks

like image 580
saTech Avatar asked Oct 01 '13 08:10

saTech


People also ask

Why SELECT is a DML statement?

Data Manipulation Language (DML) Statements The SELECT statement is a limited form of DML statement in that it can only access data in the database. It cannot manipulate data in the database, although it can operate on the accessed data before returning the results of the query.

How SELECT is DML?

if you refer to 11g Documentation as in HERE - Types of SQL Statements, you will find that Select is a DML statement, which is a limited form of DML, which can query the data and not manipulate it. SELECT .. INTO can manipulate (modify) data, even if it is not changing the stored data.

Is SELECT an example of DML?

Examples of DML SELECT − Retrieve data from the database. INSERT − Insert data into a table. UPDATE − Update existing data within a table. DELETE − Delete records from a database table.

Is the SELECT statement DDL?

DDL stands for Data Definition Language and are the statements required to create the tables used in the SELECT statement examples.


2 Answers

The distinction that people usually make is between DDL (data definition language, i.e. managing schema objects) and DML (data manipulation language, i.e. managing data within the schema created by DDL). Clearly a SELECT is not DDL.

like image 50
Thilo Avatar answered Sep 27 '22 23:09

Thilo


Data Manipulation Language (DML) is a vocabulary used to query/retrieve and work with data. Don't go by the word Manipulation, such statement allows both data accessing and processing. As you have tagged question with SQL Server 2005 following link can be referred:

http://technet.microsoft.com/en-US/library/ms177591(v=SQL.90).aspx

like image 28
Deepshikha Avatar answered Sep 28 '22 00:09

Deepshikha