0% found this document useful (0 votes)
7 views3 pages

DML Notes

DML, or Data Manipulation Language, is a subset of SQL used to manage and manipulate data in database tables through commands like INSERT, UPDATE, DELETE, and SELECT. DML operations are temporary until committed, and they can be controlled with commands such as COMMIT, ROLLBACK, and SAVEPOINT. Each command has specific syntax and purpose, allowing users to add, modify, remove, and retrieve data effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

DML Notes

DML, or Data Manipulation Language, is a subset of SQL used to manage and manipulate data in database tables through commands like INSERT, UPDATE, DELETE, and SELECT. DML operations are temporary until committed, and they can be controlled with commands such as COMMIT, ROLLBACK, and SAVEPOINT. Each command has specific syntax and purpose, allowing users to add, modify, remove, and retrieve data effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Notes on DML (Data Manipulation Language) in Database

What is DML?
- DML stands for Data Manipulation Language.
- It is a subset of SQL (Structured Query Language).
- DML commands are used to manage and manipulate data stored in database tables.
- It allows users to perform operations like inserting, updating, deleting, and retrieving data.

Types of DML Commands:

1. INSERT
- Used to add new records (rows) into a table.
Syntax:
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);

2. UPDATE
- Used to modify existing records in a table.
Syntax:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

Note: Use WHERE clause carefully, otherwise all rows will be updated.

3. DELETE
- Used to remove records from a table.
Syntax:
DELETE FROM table_name
WHERE condition;

Note: Without WHERE clause, all records will be deleted.


4. SELECT
- Used to retrieve data from one or more tables.
Syntax:
SELECT column1, column2, ...
FROM table_name
WHERE condition;

Characteristics of DML:
- DML operations are temporary unless committed.
- DML commands are used by end-users and developers for day-to-day data management.
- DML operations can be controlled using:
- COMMIT -> Save changes permanently.
- ROLLBACK -> Undo changes.
- SAVEPOINT -> Create intermediate checkpoints.

Transaction Control with DML:


Command | Purpose
------------|-----------------------------------
COMMIT | Save all changes made by DML.
ROLLBACK | Undo changes before COMMIT.
SAVEPOINT | Set a point to roll back to.

Example:
-- Insert new record
INSERT INTO students (id, name, grade) VALUES (1, 'John', 'A');

-- Update record
UPDATE students SET grade = 'B' WHERE id = 1;

-- Delete record
DELETE FROM students WHERE id = 1;
-- Select data
SELECT * FROM students;

You might also like