I was going through DML SQL statement. Select as they say is a SQL data statement and these are also called as DML.
most of the articles explain it with below eg: If select is used as below then it is classified as DML
Select COl1, COl2
into Table2 #this -- part will create a table named
-- as table2 with column col1 and col2
from Table1; -- 3 columns will be copied from table1 to table2
1) Can somebody Please explain what is exactly happening in the query
Select COL1, Col2
into TABLE2
from TABLE1;
2) How is this a DML statement?
3) Is there is any difference between SQL data statement and DML or both are same ? http://www.firstsql.com/tutor1.htm
EDIT: To answer the question title as well, SELECT
is not a DDL (Data definition language). DDL statements modify database layout, like CREATE TABLE
. DML statements are queries data, like SELECT
; or modifies data, like INSERT
.
Another edit: It seems SELECT INTO
is not fully supported in mysql. Even though answer is still valid for general SQL. For me, SELECT INTO
's table creation aspect is a side effect. thus it is still a DML.
I think you can correctly view it as a hybrid that accomplishes both data manipulation (selecting and inserting) and definition (table creation). I don't think you'll find SELECT...INTO
in the standard language which is one reason you probably can't apply a strict distinction between DML and DDL here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.