×

SQL Data Manipulation Language

Data Manipulation Language manipulates/make changes in data present in a table.

It only affects data/records of table, not on the schema/structure of table.

INSERT, UPDATE, DELETE are the commands of DML.

INSERT: Stores data in a table or creates new records by inserting values.
UPDATE: It modifies the record in a table.
DELETE: Deletes on or more records from table.
Syntax:
  1. INSERT INTO table_name VALUES ( value1,value2,….);
  2. INSERT INTO table_name (column 1,column 2, column 3) VALUES (value1, value2,value3);

Example:

INSERT INTO STUDENT VALUES (0001,'ARUN','CS','FIRST');
INSERT INTO STUDENT (classyear, student_name,student_dept,student_id) VALUES ('FIRST','VRUN','CS',0002);

Here, user can change the sequence of columns while inserting values in table. We can increase or decrease number of columns.

Syntax:

DELETE FROM Table_name [WHERE Condition];

Example:

Delete From Student Where Student_id=06;

Here, Single row is deleted as per where condition.

Delete From Student Where Student_name=’ARYA’;

Multiple rows deleted, as three rows were present with the same name ARYA. Here, where condition decides how many records to delete.

Delete From Student;

In the above query, where condition is not specified so, all records are deleted from STUDENT table. If user want to delete single or multiple records then where condition is required. Delete query without where condition deletes all records from table.

Syntax:

UPDATE Table_name set column_name = value [Where condition];

Example:

update student set student_dept='ele' where student_name='GITA';
UPDATE Student SET classyear='FINAL' Where student_id=9;

By using UPDATE command, user can update single value or multiple values in the table.

To change single value/to change specific value, ‘Where’ condition is required.

UPDATE without where condition changes complete column values in the table.

UPDATE STUDENT SET student_dept='EXTC';


Related Topics

SQL CASE

This page contains all the information about SQL CASE. The CASE is an If-Else type of logical query used in the statement. The CASE in Structured Query Language is similar...

5 minutes read.

DML Commands in SQL

DML is an abbreviation of Data Manipulation Language. Data Manipulation Language commands in Structured Query Language manipulate the data in the database. DML commands are used to retrieve records, add records,...

4 minutes read.

Grant Command in SQL

What is DCL (Data Control Language)? Data Control Language (DCL) is a computer programming language with syntax intended to manage access to data kept in databases. It is a part of...

3 minutes read.

How to delete column in table

Introduction In SQL, sometimes it is required to delete a column of a table.The use of ALTER TABLE command with DROP COLUMN clause will serve the purpose to delete/remove a column...

4 minutes read.

SQL CRUD Operation

In any computer language, CRUD operation is a foundation. CRUD operation rules are applied in databases as well. These operations are the basic operations used to perform with any database...

7 minutes read.

SQL Commands

SQL commands are classified into four groups on the basis of their nature. DDL (Data Definition Language) DML (Data Manipulation Language) DCL (Data Control Language) DQL (Data Query Language) NOTE: This...

1 minute read.

SQL INSERT INTO Values

This article will help you in getting a better understanding of a very important SQL INSERT INTO VALUES function. INSERT INTO statement is used to insert or add a new record...

4 minutes read.

Where Condition in SQL

WHERE clause is used with the Data Manipulation Language Command in SQL, the Data Manipulation Language commands are the SELECT statement, UPDATE statement, and DELETE statement. WHERE clause condition is an...

5 minutes read.

Types of SQL JOIN

The SQL JOIN combines one or more than one tables based on their relationship. The SQL JOIN involves a parent table and a child table relationship. There are different types of...

10 minutes read.

How to Create Temporary Table in SQL?

How to Create Temporary Table in SQL  Introduction to Temporary Tables Temporary table is a table which is used to store temporary data that can be used further in the same client...

3 minutes read.

SQL Select Distinct

The SQL DISTINCT query is used to fetch unique values from the tables using the SELECT statement in the SQL. There may be a situation that arises when you want to...

4 minutes read.

Save Point in SQL

In SQL, the classification is done into 4 languages. They are Data Definition Language (DDL)Data Manipulation Language (DML)Transaction Control Language (TCL)Data Control Language (DCL) Save Point falls under the Transaction Control Language....

4 minutes read.

How to use GROUP BY clause in SQL

In this SQL article, we will learn about the GROUP BY clause and how to use it in SQL. We will also discuss using the GROUP BY clause with the...

6 minutes read.

SQL Data Types

In SQL DATA TYPES, each column holds value. Data types can be an integer type, character type, etc., and such data is stored in the database table. The data type is...

4 minutes read.

Nth highest salary

The most common and important question asked in interviews that how we can find the Nth highest salary in a table (2nd highest salary, 3rd highest salary, or Nth highest...

6 minutes read.

GROUP BY vs ORDER BY

The GROUP BY clause and ORDER BY clause in SQL are used to arrange data obtained by SQL queries. The important difference between the GROUP BY clause and ORDER BY...

4 minutes read.

SQL Insert multiple rows

This article will deal with a new insertion method in SQL which inserts multiple rows at a time. Multiple records can be inserted at a time into a specific table with...

4 minutes read.

SQL DELETE

In this tutorial, you will learn about the SQL DELETE concept by using examples. In Structured Query Language (SQL), we fetch the data from the database table using SELECT Statement and...

3 minutes read.

SQL SELECT LIKE Operator

The SQL SELECT LIKE Operator tutorial helps us understand how to use the LIKE operator in the SELECT query with examples. The SQL SELECT LIKE Operator retrieves the records from the...

4 minutes read.

SQL COPY Table

In this tutorial, we will learn how to copy tables in SQL with the help of examples. Using the SELECT INTO statement in the SQL we can copy one table into...

4 minutes read.