This article describes about the basic overview of DDL and DML and their difference . Summary of the article:
- Data Definition Language (DDL)
- Examples of DDL
- Data Manipulation Language (DML)
- Examples of DML
- DDL VS DML
Data Definition Language (DDL)
DDL is a computer language used to define the database structure or schema. It is used to create and modify the structure of database objects in database.
Examples of DDL
Some Examples of DDL are:
- CREATE – to create objects in the database.
- ALTER – alters the structure of the database.
- DROP – delete objects from the database.
- TRUNCATE – remove all records from a table, including all spaces allocated for the records are removed.
- COMMENT – add comments to the data dictionary.
- RENAME – rename an object.
Data Manipulation Language (DML)
DML is a computer language used to manipulate data in a database/schema objects. It is used to retrieve, store, modify, delete, insert and update data in database.
Examples of DML
Some examples of DML are:
- SELECT – retrieve data from the a database.
- INSERT – insert data into a table.
- UPDATE – updates existing data within a table.
- DELETE – deletes all records from a table, the space for the records remain.
- MERGE – UPSERT operation (insert or update).
- CALL – call a PL/SQL or Java subprogram.
- EXPLAIN PLAN – explain access path to data.
- LOCK TABLE – control concurrency.
DDL VS DML
The difference between DDL and DML:
DDL
- DDL is used to define the database structure or schema
- Some examples: CREATE, ALTER, DROP, RENAME
DML
- DML is used to manipulate data in a database/schema objects
- Some examples: SELECT, INSERT, UPDATE, DELETE
That’s all about DDL and DML.
Its good and very informative.