views:

35

answers:

1

is it possible to automatically delete a row in a table if a certain condition is met?

for example a products table

pid     pname     quantity
1       shoes     5

now the condition must be if quantity is equal to 0 then the whole row must be deleted

+2  A: 

Issue the query DELETE FROM table WHERE quantity = 0 and all rows satisfying the condition will be deleted.

Michael Madsen