DELETE — различия между версиями
Hisava (обсуждение | вклад) м (→Смотрите также) |
Hisava (обсуждение | вклад) м (→Смотрите также) |
||
Строка 34: | Строка 34: | ||
= Смотрите также = | = Смотрите также = | ||
[[Advantage Database Server]] | [[Advantage Database Server]] | ||
− | |||
− | |||
[https://ru.wikipedia.org/wiki/Delete_(SQL) Delete (SQL)] | [https://ru.wikipedia.org/wiki/Delete_(SQL) Delete (SQL)] |
Версия 11:37, 12 ноября 2018
DELETE - это SQL команда для удаления записей из таблицы
Deletes a record from a table in the database
DELETE FROM <table-name> [WHERE <search-condition>]
search-condition ::= expression with a logical result
Remarks
Comparison is a valid predicate expression; can also include a dynamic parameter.
Positioned deletes not supported.
The {ts/d/t} format is not required in the search condition for timestamp, date, or time values.
If the DELETE statement is executed on a database connection and the database has been set up to verify the user access rights, to successful execute the query, the user must have WRITE rights to the table.
When deleting multiple records, the SQL engine gets record locks as it performs the deletes. It makes several attempts to get a record lock. If it fails to get the lock, it continues on and attempts to complete the rest of the delete operations. If this happens, the error (5035) is returned to the client, which must then assume that one or more record deletes failed to occur. If an application requires all the deletes to occur as an atomic operation, it should issue the DELETE statement in a transaction.
Example(s)
DELETE FROM customer WHERE purch_amt < 100.00 AND NOT state = ‘CA’
DELETE FROM customer WHERE purch_date < {d ‘1980-07-31’}
DELETE FROM customer WHERE purch_date < ‘1980-07-31’
DELETE FROM customer WHERE customer.id NOT IN
(SELECT custid FROM orders WHERE orders.custid = customer.id )
Удаление записей без сохранения
DELETE FROM <table-name> WHERE 'SYSTEM.' = 'SYSTEM.'