SQL DELETE

From Lianjapedia
Jump to: navigation, search

Purpose

Deletes one or more rows from a table

Syntax

DELETE FROM [<database>! | <database>.]<table>

[WHERE CURRENT OF <cursor> | <condition>]

See Also

ADD TABLE, CLOSE, CREATE DATABASE, DECLARE CURSOR, DROP CURSOR, EXECUTE IMMEDIATE, FETCH, GETENV(), INSERT, OPEN, OPEN DATABASE, SET AUTOCATALOG, TRUNCATE TABLE, UPDATE, USE

Description

The DELETE command executes an immediate physical deletion of the specified records i.e., records are permanently removed from the table, and cannot be recalled.

To perform a DELETE operation you must have the DELETE privilege or be the owner of the table.

Keywords Description
database The name of the database to which the table belongs. The '!' or '.' character must be included between the database name and the table name.
table The name of the table from which to delete the rows.
WHERE Specifies which rows are to be deleted.
CURRENT OF cursor Deletes only the row most recently fetched by the cursor.
condition Deletes only the rows that satisfy the condition.

Example

DELETE FROM staff WHERE ord_date < date()