Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

DELETE Statement



The SQL DELETE Statement


The SQL DELETE statement is used to remove one or more rows from a table. Its basic syntax is as follows:

DELETE FROM table_name
WHERE condition;

For example, if you have a table called customers and you want to delete a customer with a specific customer_id, you can execute

DELETE FROM customers
WHERE customer_id = 123;

This will delete the row(s) from the customers table where the customer_id is 123.

If you omit the WHERE clause, like so:

DELETE FROM customers;

This will delete all rows from the customers table, effectively emptying it. However, be cautious when using DELETE without a WHERE clause, as it will remove all records from the table, which may not be what you intended. Always ensure you have a backup or are certain of the consequences before executing such a statement.



Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java