SQL DELETE Statement: How to Delete Data from Table in SQL with Examples | Step-by-Step Guide

SQL TUTORIALS-

SQL DELETE Statement

Introduction-


Trulli Trulli

SQL DELETE Statement- How to use the SQL DELETE statement to remove data from a database table

-✅ DELETE statement in SQL is used to remove one or more rows from a table based on a condition...

✅ Example 1:Basic syntax is Follow:-


DELETE FROM table_name
WHERE condition;



✅ table_name: The name of the table from which you want to delete data.

✅ condition: A filter to select which rows should be deleted.


Emoji Examples in HTML

🔸 Example Table: Employees

ID Name Department Salary
1 ANNI IT 10000
2 POOJA IT 9000
3 RAJ HR 5000

✅ Example 2: Delete a single row:-


DELETE FROM Employees
WHERE EmployeeID = 2;



This deletes the employee with ID 2 from the Employees table.

Result Show :-

Emoji Examples in HTML

🔸 Example Table: Employees


ID Name Department Salary
1 ANNI IT 10000
3 RAJ HR 5000

✅ Example 3: Delete all rows:-

Delete Query :-


DELETE FROM Customers;


Deletes all records from the Customers table.

Result Show :-

Emoji Examples in HTML

🔸 Example Table: Employees

ID Name Department Salary

Example 4: Delete Based on a Condition:-

Delete Query :-


DELETE FROM Employees
WHERE Department = 'HR';


Deletes all employees who belong to the HR department.

Result Show :-

Emoji Examples in HTML

🔸 Example Table: Employees

ID Name Department Salary
1 ANNI IT 8000
2 POOJA IT 62000

May Be Like Important Link-

-SQL Tutorial for Beginners – Introduction to SQL

-SQL TOP, LIMIT, FETCH FIRST or ROWNUM Clause

-SQL SELECT DISTINCT Statement Clause Explained with Examples

-SQL Wildcard Characters: Complete Guide with Examples