what is the difference between dml and ddl in sql code example
Example 1: difference between ddl and dml
DDL
1-It stands for Data Definition Language.
2-It is used to create database schema and can
be used to define some constraints as well.
3-It basically defines the column (Attributes) of the table.
4-It doesn’t have any further classification.
5-Basic command present in DDL are CREATE, DROP, RENAME, ALTER etc.
6-DDL does not use WHERE clause in its statement.
DML
1-It stands for Data Manipulation Language.
2-It is used to add, retrieve or update the data.
3-It add or update the row of the table. These rows are called as tuple.
4-It is further classified into Procedural and Non-Procedural DML.
5-BASIC command present in DML are UPDATE, INSERT, MERGE etc.
6-While DML uses WHERE clause in its statement.
Example 2: dml vs ddl sql
DML commands actions can be stored
DLL command actions can't be stored.
DML = SELECT, INSERT, UPDATE, DELETE, MERGE
DDL = CREATE, ALTER, TRUNCATE, DROP TABLE, RENAME