Changing text, unitext, and image data  Using the from clause with delete

Chapter 7: Adding, Changing, and Deleting Data

Deleting data

delete works for both single-row and multiple-row operations.

A simplified version of delete syntax is:

delete table_name 
     where column_name = expression 

The complete syntax statement, which you can find in the Reference Manual, shows that you can remove rows either on the basis of specified expressions or based on data from other tables:

delete [from] 
     [[database.]owner.]{view_name | table_name}
     [where search_conditions]

delete [[database.]owner.] {table_name | view_name} 
     [from [[database.]owner.]{view_name | table_name
          [(index {index_name | table_name }
               [prefetch size ] [ lru | mru])]} 
          [, [[database.]owner.] {view_name | table_name
          (index {index_name | table_name }
               [prefetch size ] [lru | mru])]}]...] 
     [where search_conditions]
delete [from] 
     [[database.]owner.] {table_name | view_name}
     where current of cursor_name 

The where clause specifies which rows are to be removed. When no where clause is given in the delete statement, all rows in the table are removed.





Copyright © 2005. Sybase Inc. All rights reserved. Using the from clause with delete

View this book as PDF