Implementation of DML Commands in SQL
DML (Data Manipulation Language) commands are used to insert, modify, and delete data in
database tables.
Assume the following table already exists:
CREATE TABLE Student (
Student_ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Course VARCHAR(30)
);
1. INSERT Command
The INSERT command is used to add new records into a table.
Syntax
INSERT INTO table_name (column1, INSERT INTO Student (Student_ID, Name,
column2, ...) Age, Course)
VALUES (value1, value2, ...); VALUES (101, 'Arun', 20, '[Link] IT');
INSERT INTO Student (Student_ID, Name,
Age, Course)
VALUES (102, 'Priya', 19, 'BCA');
Student_ID Name Age Course
101 Arun 20 [Link] IT
102 Priya 19 BCA
2. UPDATE Command
The UPDATE command is used to modify existing records in a table.
Syntax
UPDATE table_name UPDATE Student
SET column_name = value SET Course = '[Link] Computer Science'
WHERE condition; WHERE Student_ID = 101;
Student_ID Name Age Course
101 Arun 20 [Link] Computer Science
102 Priya 19 BCA
3. DELETE Command
The DELETE command is used to remove records from a table.
Syntax
DELETE FROM table_name DELETE FROM Student
WHERE condition; WHERE Student_ID = 102;
Student_ID Name Age Course
101 Arun 20 [Link] Computer Science
Summary Table
Command Purpose Example
INSERT INTO Student VALUES
INSERT Adds new records into a table
(101,'Arun',20,'[Link] IT');
UPDATE Student SET Course='[Link]
UPDATE Modifies existing records
Computer Science' WHERE Student_ID=101;
DELETE FROM Student WHERE
DELETE Removes records from a table
Student_ID=102;