DB2 data manipulation language statements

DB2 DDL LIKE Statement DB2 SELECT Statement

Advertisements


Data Manipulation language used to manipulate the data inside the table.

DML also uses to control the data inside the database table.

The main manipulation statements are:

  • SELECT
  • INSERT
  • UPDATE
  • DELETE

SELECT:

Select statement is the main query hence it is used to retrieve the data from the tables.

Select statement also used in the Cursor declaration for retrieving the data for the cursor.

Select statement is more powerful hence it has the below clauses which is mainly used in the SELECT to retrieve the data in smarter ways.

SELECT statement explained in detail here .

INSERT:

INSERT statement is used to insert the data into the table or view.

INSERT can insert one row or more than one row at a time.

Inserting into VIEW can insert the data into TABLE as well.

INSERT can insert actual data and as well as NULLs also into nullable columns.

To perform INSERT operation, user should have INSERT privilege on the table.

INSERT statement explained in detail here .

UPDATE:

UPDATE statement is used to update the rows which are already existed in the table.

UPDATE can be single row update or mass update (more than one row) based on the condition provided in WHERE clause.

User should have UPDATE privilege on the table to perform UPDATE operation.

Updating row in view can update the row in base table as well.

UPDATE statement explained in detail here .

DELETE:

DELETE statement is used to delete the row/rows from the table or view.

DELETE statement can delete more than one row/rows from the table/view based on the condition specified in WHERE clause.

Deleting a row from VIEW can delete the row from the base table as well.

User should have DELETE privilege to perform DELETE operation on table or view.

DELETE statement explained in detail here .


If any questions on the above, post your queries on DB2 Discussion forum


DB2 DDL LIKE Statement DB2 SELECT Statement

Advertisements