SQL Tutorial 6: Data Manipulation Language

SQL Tutorial 6: Data Manipulation Language

Data Manipulation Language (DML) is a one of the Subset of SQL, others are,

i) Data Definition Language
ii) Data Control Language etc…

Database Engine is required to practice/execute SQL Commands…

Database Engine either Oracle or MS SQL Server or mySQL etc…

I installed MS SQL Server Express Edition, It is free Software for Small scale
organizations, you can use any other Database Engine also, anyhow Most of the
SQL Commands are common for all RDBMS….

Data Manipulation Language commands are used to store, modify, retrieve, and delete data from database tables. In this category we have Select, Insert, Update, Delete Commands….
Important Data manipulation language Commands are,

1) SELECT – Retrieves data from a table
2) INSERT – Inserts data into a table
3) UPDATE – Updates existing data into a table
4) DELETE – Deletes all records from a table

In Order to practice/use SQL DML Commands, first I create a Database, a Table and these are SQL DDL Operations (we have to use DDL Commands)…

Next Insert records in to the table, It is DML Operation…


—Create a Database, table, and insert records…
Create database gcreddy;

Use gcreddy;
Create table abcd(
Id int,
Name varchar (40),
City varchar (30),

Insert Into abcd
(Id, Name, City)
values (1, ‘G C Reddy’, ‘Hyderabad’);

Insert Into abcd
(Id, Name, City)
values (2, ‘Mahith’, ‘Nellore’);
Data Manipulation Commands,

1) Select: The SELECT Statement is used to select data from a database. The result
is stored in a result table, called the result-set.

The SELECT command is the most commonly used command in SQL. It allows database
users to retrieve the specific information they desire from an operational database.

/* Select Syntax

Select colomn1, column2, …
From Table_Name;

Select * From Table_Name; */

Select Id, Name From abcd;

Select * From abcd;
2) Insert: The INSERT INTO Statement is used to insert new records in a table. We
can insert data to a table in two ways,

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

Insert Into abcd (Id, Name, City)
values(4, ‘Vijaya’, ‘Kavali’);
Insert Data Only in Specified Columns

Insert Into abcd (Name)
values (‘Cinnu’);
Note: If you insert specified column only then remaining columns are Null…
3) Update: The UPDATE statement is used to update existing records in a table.


UPDATE table_name

SET column1=value, column2=value2,…
WHERE some_column=some_value


Update abcd
Set Name = ‘Venkat’, City = ‘Mumbai’
Where Id = 1;
4) Delete: The SQL DELETE Query is used to delete the existing records from a table.
You can use WHERE clause with DELETE query to delete selected rows,
otherwise all the records would be deleted.

Syntax: DELETE FROM table_name [WHERE condition];


Delete From abcd
Where Id = 4;

Delete From abcd;
SQL Step by Step Tutorials

SQL Tutorial 1: Introduction to SQL

SQL Tutorial 2: SQL Overview

SQL Tutorial 3: SQL Environment Setup

SQL Tutorial 4: Database Fundamentals and SQL Language Elements

SQL Tutorial 5: Data Definition Language

SQL Tutorial 6: Data Manipulation Language

SQL Tutorial 7: SQL Operators

SQL Tutorial 8: The Select Query

SQL Tutorial 9: SQL Joins

SQL Tutorial 10: SQL Functions

SQL Tutorial 11: SQL Comments

SQL Tutorial 12: SQL Date Functions

Top 10 Database Management Systems

SQL vs. NoSQL Databases

SQL Interview Questions and Answers

Follow me on social media:

Leave a Comment