delete from account
                 where balance < (select avg (balance )
                                  from account )

这个语句在mysql中运行会产生如下错误Error Code : 1093
You can't specify target table 'account' for update in FROM clause
(0 ms taken)

大概意思就是 对于更新中的from语句,你指定不了一个目标表 account 。个人理解就是 随着你的删除操作 avg()也在动态的跟新,这样如果还允许你删除的话,后果是无法想象的。 数据库系统原理 上是这么说的Problem:  as we delete tuples from deposit, the average balance changes Solution used in SQL:  

1.   First, compute avg balance and find all tuples to delete  
2.   Next, delete all tuples found above (without recomputing avg or  retesting the tuples) 

要解决这个问题 就是让要avg()不随删除 过程而动态的去改变就要
1、先查询出 avg() 作用为一个结果集保存   
2、再从这个结果集中取avg的值
实例语句:delete from branch where branch_assets > (select a.asset from (select avg(branch_assets) as asset from branch) a)
这样就可以 搞定这个错误啦!