The latest "SQL Basics" article from Builder.com and author Shelley Doll steps the reader through the process of deleting rows from tables that are dependent on criteria from other tables. The solution lies in a clever, but completely SQL92-compliant application of subselect, or subquery statements.
The article's solution should function for most databases; however, you should always consult your documentation if your results vary. Although a query may be compliant, various database manufacturers implement SQL with different syntax support. Also, because the query deals with the DELETE statement, readers should test the query on test data before using it in a production environment.
The complete article is available at
Back to Database Journal Home