Sitemap

DATA MANIPULATION LANGUAGE (DML) INSERT, UPDATE, & DELETE

2 min readOct 26, 2025

--

In this section we will discuss Data Manipulation Language (DML) of INSERT, UPDATE, & DELETE

Get Satria Tech’s stories in your inbox

Join Medium for free to get updates from this writer.

Briefly, the three DMLs above can be explained as follows :

  1. INSERT, used to add data individually or several data and rows of data at once. The following is an example of a query :

1.1. INSERT query for data units in rows:
INSERT INTO table_name
(column_1, column_2, other_column)
VALUES (Data_1, “Data_2”, other_data);

1.2. Bulk INSERT query for data by row:
INSERT INTO table_name
(column_1, column_2, other_column)
VALUES (Data_1, “Data_2”, other_data),
(Data_1, “Data_2”, other_data);

2. UPDATE, used to update or change existing data. With UPDATE you can update existing table data. For example, if there is an error or changing condition that requires changing the data, here is an example of the query:

2.1. UPDATE query for data units in a row:
UPDATE table_name
SET column_name = “Desired_Change_Data”
WHERE column_reference_condition = reference_data;

2.2. Bulk INSERT query for data by row:
UPDATE table_name
SET column_name_1 = “Desired_Change_Data_1”, column_name_1 = Desired_Change_Data_1
WHERE column_reference_condition = reference_data;

3. DELETE, used to delete data from a database table. When the process is usually combined with the WHERE clause condition, the WHERE condition is used to limit the data in a particular table to be deleted. If WHERE is not used, then all rows of table data will be deleted :

The following is an example of a query using DELETE :
DELETE FROM reference_table
WHERE reference_column_data = reference_data_delete;

  1. Add new product data, namely a ruler with a price of 10.000 and stock of 10 :
INSERT INTO products 
(product_id, product_name, unit_price, stock)
VALUES ('P006','Rule',10000,10);

2. Add 2 product order data, 1 ruler and 2 other orders.

INSERT INTO order_details 
(detail_id, order_id, product_id, quantity)
VALUES (7, 'A004', 'P006', 1),
(8, 'A005', 'P006', 2);

3. Change the product name from Notebook to Laptop.

UPDATE products 
SET product_name = 'Laptop'
WHERE product_id = 'P001';

4. Change the unit price and stock of the products.

UPDATE products 
SET unit_price = 3500, stock = 200
WHERE product_id = 'P002';

5. Delete order data with detail id = 6.

DELETE FROM order_details
where detail_id = 6;

6. Delete all order_details table data.

DELETE FROM order_details;

Here are the links to the table files and previous articles :
1. GitHub file link :
https://github.com/bagaskara0506/DB_product-order.git

2. Previous Article :
https://medium.com/@satriadevopsindonesia/arithmetic-and-aggregate-operations-in-sql-queries-3fd9f18a09e3

This is an explanation of DML INSERT, UPDATE, and DELETE.

Date Created : October 26, 2025
Author : Satria Bagaskara

--

--