Data Manipulation Language

SQL – Data Manipulation Language

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

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

Database Engine is required to practice/execute SQL Commands,

We can use Database Engine from 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…

SQL – DML  Commands

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 into the table, It is DML Operation…

Example:

—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’);


DML 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,

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

Example:
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 a specified column only then the remaining columns are Null…

3. Update:

The UPDATE statement is used to update existing records in a table.

Syntax:

UPDATE table_name

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

Example:

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 the WHERE clause with the DELETE query to delete selected rows, otherwise, all the records would be deleted.

Syntax:

DELETE FROM table_name [WHERE condition];

Example:

Delete From abcd
Where Id = 4;

Delete From abcd;


SQL Syllabus
SQL Queries for Software Testers
SQL Step by Step Tutorial – Full Course for Beginners
Manual Testing Tutorial
Java Tutorial
Python Tutorial
Follow me on social media: