delete from rwhere P
Tuples in r for which P is true are deleted. If the where clause is omitted, all tuples are deleted.
delete from depositorwhere cname=``Smith''
delete from loanwhere loan# between 1300 and 1500
delete from accountwhere bname in
(select bname
from branch
where bcity=``Surrey'')
For example, to delete the records of all accounts with balances below the average, we might write
delete from accountwhere balance < (select avg(balance) from account)
You can see that as we delete tuples from account, the average balance changes!
Solution: The delete statement first test each tuple in the relation account to check whether the account has a balance less than the average of the bank. Then all tuples that fail the test are deleted. Perform all the tests (and mark the tuples to be deleted) before any deletion then delete them en masse after the evaluations!