×

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 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...

2 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.

Difference between Delete, Drop and Truncate in SQL

What is the Delete command in SQL? In DML (Data Manipulation Language), we use the delete command that allows us to delete the some entries and modify the databases in SQL....

4 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.

SQL Operators

Arithmetic Operators Arithmetic operators are +, -, *, /, % performs addition, subtraction, multiplication, division, modulo respectively. Example:   Select 100+222; Select salary+100 From teacher Where teacher_id=1; Following output screen shows different arithmetic operations. We...

2 minutes read.

SQL SET Operator

In this tutorial, we will understand the operator who falls under the SET operator in SQL with the help of different examples. The SQL SET Operator is used to merge the...

5 minutes read.

SQL Syntax

In this tutorial, we will help you understand about the different SQL Syntax concepts with the help of an example. Every Structured Query Language starts with Keywords like select, insert, update,...

5 minutes read.

SQL Aliases

SQL Aliases: These are used to give a temporary name for a column or table. These are used to make tables or columns more readable. These are used to rename the table...

2 minutes read.

SQL LOGICAL Operator

In this tutorial, we will understand the operator who falls under the logical operator in SQL with the help of examples. The SQL Logical Operator displays the query result in one...

5 minutes read.

SQL FOREIGN KEY

In this article, we will learn about the FOREIGN KEY constraints and how to define a FOREIGN KEY constraint to build the relationship between two tables. In a Relational Databases Management...

4 minutes read.

How to use the BETWEEN operator in SQL

In this entire SQL article, we will understand and learn about the BETWEEN operator concept and how to use it in SQL. What is the BETWEEN operator in SQL? The Between operator...

4 minutes read.

SQL Create Database

This tutorial will help us understand how to CREATE a Database in SQL with a few examples. The first step for storing structured records in the database is creating the databases. We...

4 minutes read.

SQL DROP Database

This tutorial will help us understand how to drop a database from the SQL Server with a few examples. The DROP command removes all the objects stored in the database and...

4 minutes read.

SQL Inner Join

In Structured Query Language, the most used join query is the Inner join query. Inner join query retrieves the records from one or more tables with similar data or records. The...

4 minutes read.

SQL ORDER BY

SQL ORDER BY The SQL ORDER BY clause is used to sort the data stored in tables in the database. The sorting can be done in an ascending way, descending way,...

5 minutes read.

SQL Cloning Tables

Cloning a Table: To create a copy of the table. To perform the operations, without affecting the actual table. Steps for creating a Cloning Table: Step 1: Empty Table Creation The syntax for Creating...

3 minutes read.

Trigger in SQL

In this article, we will learn about the concept of trigger in SQL and its implementation with the help of an example. A Trigger in Structured Query Language is a set...

4 minutes read.

How to use INNER JOIN in SQL

In this article, we will learn about the INNER JOIN concept and how to use it in SQL with the WHERE clause. What is INNER JOIN in SQL? Inner Join is a...

6 minutes read.

SQL Arithmetic Operators

This page contains all the information, learn about SQL Arithmetic Operators concept in the SQL table with the help of examples. The Arithmetic Operators is used to perform mathematical calculations on...

5 minutes read.

SQL SELECT SUM

The SQL Sum() function is an aggregate function in SQL that returns the total values of an expression. The expression may be numerical, or it may be an expression. Syntax: SELECT SUM(columnname)...

3 minutes read.