summaryrefslogtreecommitdiff
path: root/src/bin/pgaccess/lib/help/delete.hlp
blob: 6bc94b0dbbf0d09073a6b5186eee95af7c30e6d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.pgaw:Help.f.t insert end "DELETE" {bold} " emoves rows which satisfy the WHERE condition, from the specified table.  \
If the condition is absent, the effect is to delete all rows in the table. The result is a valid, but empty table.  \
You must have write access to the table in order to modify it, as well as read access to any table whose values are read in the condition. 

" {} "Synopsis" {bold} "
" {} "
   DELETE FROM table \[ WHERE condition \]
   
" {code} "Usage" {bold} "

Remove all films but musicals: 
" {} "
DETETE FROM films WHERE kind <> 'Musical';

SELECT * FROM films;

code |title                    |did| date_prod|kind      |len
-----+-------------------------+---+----------+----------+------
UA501|West Side Story          |105|1961-01-03|Musical   | 02:32
TC901|The King and I           |109|1956-08-11|Musical   | 02:13
WD101|Bed Knobs and Broomsticks|111|          |Musical   | 01:57
(3 rows)
  

Clear the table films: 

DELETE FROM films;
   
SELECT * FROM films;
code|title|did|date_prod|kind|len
----+-----+---+---------+----+---
(0 rows)

" {code} "Compatibility" {bold} "

SQL92 

SQL92 allows a positioned DELETE statement: 

DELETE FROM table WHERE CURRENT OF cursor
   

where cursor identifies an open cursor. Interactive cursors in Postgres are read-only. "