What is the difference between DDL and DML statements in DB2?

1 Answers
Answered by suresh

Difference Between DDL and DML Statements in DB2

When it comes to DB2, understanding the difference between Data Definition Language (DDL) and Data Manipulation Language (DML) statements is essential. Here's a breakdown of the key distinctions:

Data Definition Language (DDL) Statements:

  • DDL statements are used to define or modify the structure of database objects such as tables, indexes, and views.
  • Common DDL statements in DB2 include CREATE, ALTER, and DROP commands.
  • DDL statements do not directly manipulate data but rather define the logical and physical structure of the database.
  • Examples of DDL statements in DB2 are CREATE TABLE, ALTER TABLE, and DROP TABLE.

Data Manipulation Language (DML) Statements:

  • DML statements are used to manipulate data stored in database objects.
  • Common DML statements in DB2 include SELECT, INSERT, UPDATE, and DELETE commands.
  • DML statements focus on querying, adding, modifying, or deleting data within tables.
  • Examples of DML statements in DB2 are SELECT * FROM table_name, INSERT INTO table_name, UPDATE table_name SET column=value, DELETE FROM table_name.

In summary, DDL statements are used for defining and modifying the structure of database objects, while DML statements are used for manipulating the data within those objects in DB2.

Answer for Question: What is the difference between DDL and DML statements in DB2?