DEV Community

Punitha
Punitha

Posted on

DML & DQL

What is DML?

DML (Data Manipulation Language) is used to insert, update, and delete data stored in database tables.

  • INSERT

  • UPDATE

  • DELETE

INSERT - The INSERT statement adds new records to a table.

INSERT INTO table_name(column1, column2)
VALUES (value1, value2);

INSERT INTO Student
VALUES (101, 'John', 90);
Enter fullscreen mode Exit fullscreen mode

UPDATE - The UPDATE statement modifies existing records.

UPDATE table_name
SET column_name = value
WHERE condition;

UPDATE Student
SET Marks = 95
WHERE Student_ID = 101;
Enter fullscreen mode Exit fullscreen mode

DELETE - The DELETE statements removes records from a table.

DELETE FROM table_name
WHERE condition;

DELETE FROM Student
WHERE Student_ID = 101;
Enter fullscreen mode Exit fullscreen mode

What is DQL?

DQL (Data Query Language) is used to retrieve data from a database.

  • SELECT

SELECT - The SELECT statement retrieves one or more records from a table.

SELECT column_name
FROM table_name;

SELECT * FROM Student;

SELECT Name FROM Student;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)