---
title: "What is the DELETE statement in SQL, and how is it used to remove data from a table?"  
description: "What is the DELETE statement in SQL, and how is it used to remove data from a table?"  
author: "Steilla Mitchel"  
published: 2023-08-30  
updated: 2023-08-31  
canonical: https://www.mindstick.com/forum/159778/what-is-the-delete-statement-in-sql-and-how-is-it-used-to-remove-data-from-a-table  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 2 minutes  

---

# What is the DELETE statement in SQL, and how is it used to remove data from a table?

What is the [DELETE](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) [statement in SQL](https://www.mindstick.com/forum/33706/what-is-the-difference-between-having-clause-and-group-by-statement-in-sql-server), and how is it used to [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) from a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap)?

## Replies

### Reply by Aryan Kumar

The DELETE statement in [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) is used to remove data from a table. The basic syntax of the DELETE statement is:

```plaintext
DELETE FROM table_name WHERE condition;
```

The `table_name` is the name of the table from which you want to delete data. The `condition` is an optional clause that specifies the rows that you want to delete. If you omit the `condition` clause, all rows in the table will be deleted.

For example, the following statement will delete all rows from the `customers` table:

```plaintext
DELETE FROM customers;
```

The following statement will delete all rows from the `customers` table where the `country` column is equal to "USA":

```plaintext
DELETE FROM customers WHERE country = 'USA';
```

You can also use the DELETE statement to delete multiple rows from a table by specifying a list of row IDs in the `condition` clause. For example, the following statement will delete the rows with IDs 1, 2, and 3 from the `customers` table:

```plaintext
DELETE FROM customers WHERE id IN (1, 2, 3);
```

The DELETE statement is a powerful tool that can be used to remove data from a table. It is important to use it carefully, as it can be irreversible.

Here are some additional things to keep in mind when using the DELETE statement:

- The DELETE statement is a DML (Data Manipulation Language) statement. DML statements are not reversible, so it is important to make sure that you are deleting the correct data.
- If you are deleting data from a table that is joined to other tables, you may need to use the `WHERE` clause to specify the rows that you want to delete from each table.
- The DELETE statement can be used to delete data from a view, but it cannot be used to delete data from a stored procedure.


---

Original Source: https://www.mindstick.com/forum/159778/what-is-the-delete-statement-in-sql-and-how-is-it-used-to-remove-data-from-a-table

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
