Database locking is a varied, evolving, complicated, and technical topic. This paper sheds light on the nature of database locking and how it varies between different platforms. It also discuss the types of application issues that can arise related as a result. It then looks at ways to ferret out these issues and to resolve them before they sneak out the door with your finished product. Armed with this understanding of the enemy and how it relates to your application, you�ll be much better able to avoid disaster.
This article is part of a series. You do not have to read them in order but I will be referring to topics and explanations in previous articles: Implementing Your Own Transactions with MVCCSQL Transaction Isolation Levels ExplainedImplementing Repeatable ...
For example, to delete rows that exist in t1 that have no match in t2, use a LEFT JOIN:
DELETE t1 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.id IS NULL;
R. Epstein, M. Stonebraker, и E. Wong. Proceedings of the 1978 ACM SIGMOD international conference on management of data, стр. 169--180. New York, NY, USA, ACM, (1978)