Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Delete Statement in SQL

Delete Statement in SQL

? DELETE Statement in SQL

The DELETE statement is used to remove one or more rows from a table based on a condition.


? Syntax

DELETE FROM table_nameWHERE condition;
  • The WHERE clause specifies which rows to delete.

  • If you omit the WHERE clause, all rows in the table will be deleted.


? Examples

1. Delete specific rows

Delete employees with age less than 25:

DELETE FROM employeesWHERE age < 25;

2. Delete a single row by ID

DELETE FROM employeesWHERE id = 101;

3. Delete all rows (use with caution!)

DELETE FROM employees;

? Notes

  • DELETE removes rows but keeps the table structure intact.

  • Use transactions (BEGIN, COMMIT, ROLLBACK) to safely delete rows.

  • For faster deletion of all rows, consider TRUNCATE TABLE.


If you want, I can provide details on DELETE with joins, cascading deletes, or examples in different SQL dialects!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql