
The delete query will allow you to delete one or more rows from one or more tables.
A basic delete query looks like this:
[sql]DELETE FROM [table_name] WHERE [field] = ‘[value]‘[/sql]
Which will delete all rows in [table_name] that match your where clause. Additionally, you may use a limit clause to limit the number of rows to delete.
If you need to delete rows from multiple tables, you can do so using the following syntax:
[sql]DELETE [table1_reference], [table2_reference] FROM [table1], [table2] WHERE [table1].id = ‘[value]‘ OR [table2.id] = ‘[value]‘[/sql]
The “table references” before FROM are the actual tables to delete from. This allows you to use other tables in your query, with deleting from them as well.
That pretty much sums up this post. Next week we’ll be going over how to integrate this into PHP, then we’ll be talking about some advanced SQL stuff.




