What are some SQL delete statements available?
There are several types of SQL delete statements available.
- Delete from: a statement to remove rows from a table.
For example: Delete from table name where condition; - DELETE is commonly used to delete individual rows. For example, you can use DELETE table name WHERE condition;
- TRUNCATE TABLE, deletes all rows in a table and releases the space occupied by the table.
For example: TRUNCATE TABLE table_name; - Drop Table: This deletes the entire table and its data.
Example: DROP TABLE table name;
In this case, DELETE and TRUNCATE TABLE can be used with a WHERE clause to specify the conditions for deleting, while DROP TABLE directly deletes the entire table.