Difference between revisions of "SQL DELETE"
From Recital Documentation Wiki
Helengeorge (Talk | contribs) (→Class) |
Yvonnemilne (Talk | contribs) (→Description) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Deletes one or more rows from a table | Deletes one or more rows from a table | ||
Line 8: | Line 6: | ||
DELETE FROM [<database>!]<table> | DELETE FROM [<database>!]<table> | ||
− | [WHERE CURRENT OF <cursor> | | + | [WHERE CURRENT OF <cursor> | <condition>] |
− | + | ||
==See Also== | ==See Also== | ||
− | [[ADD TABLE]], [[CREATE DATABASE]], [[DB_DATADIR]], [[EXECUTE IMMEDIATE]], [[SQL INSERT|INSERT]], [[ | + | [[ADD TABLE]], [[SQL CLOSE|CLOSE]], [[CREATE DATABASE]], [[DB_DATADIR]], [[DECLARE CURSOR]], [[DROP CURSOR]], [[EXECUTE IMMEDIATE]], [[FETCH]], [[GETENV()]], [[SQL INSERT|INSERT]], [[OPEN]], [[OPEN DATABASE]], [[SET AUTOCATALOG]], [[SQL UPDATE|UPDATE]], [[SQL USE|USE]] |
==Description== | ==Description== | ||
− | + | For third-party gateway databases, 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. For native tables, it works in the same way as the Recital [[DELETE]] command, marking the record(s) for deletion. | |
To perform a DELETE operation you must have the DELETE privilege or be the owner of the table. | To perform a DELETE operation you must have the DELETE privilege or be the owner of the table. | ||
Line 24: | Line 21: | ||
!Keywords||Description | !Keywords||Description | ||
|- | |- | ||
− | |database||The name of the database to which the table belongs. Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database. Operating System file protection can be applied individually to the files for added security. The directory is a sub-directory of the Recital data directory. The environment variable | + | |database||The name of the database to which the table belongs. Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database. Operating System file protection can be applied individually to the files for added security. The directory is a sub-directory of the Recital data directory. The environment variable DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function. Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality. The '!' character must be included between the database name and the table name. |
|- | |- | ||
|table||The name of the table from which to delete the rows. | |table||The name of the table from which to delete the rows. | ||
Line 35: | Line 32: | ||
|- | |- | ||
|} | |} | ||
− | |||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | DELETE FROM staff | + | DELETE FROM staff WHERE ord_date < date() |
− | WHERE ord_date < date() | + | |
</code> | </code> | ||
==Products== | ==Products== | ||
− | Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL|DELETE]] | [[Category:SQL|DELETE]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Latest revision as of 15:25, 15 March 2012
Purpose
Deletes one or more rows from a table
Syntax
DELETE FROM [<database>!]<table>
[WHERE CURRENT OF <cursor> | <condition>]
See Also
ADD TABLE, CLOSE, CREATE DATABASE, DB_DATADIR, DECLARE CURSOR, DROP CURSOR, EXECUTE IMMEDIATE, FETCH, GETENV(), INSERT, OPEN, OPEN DATABASE, SET AUTOCATALOG, UPDATE, USE
Description
For third-party gateway databases, 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. For native tables, it works in the same way as the Recital DELETE command, marking the record(s) for deletion.
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. Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database. Operating System file protection can be applied individually to the files for added security. The directory is a sub-directory of the Recital data directory. The environment variable DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function. Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality. The '!' 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()
Products
Recital Server, Recital