Deleting rows from two tables using inner join SQLITE Deleting rows from two tables using inner join SQLITE sqlite sqlite

Deleting rows from two tables using inner join SQLITE


In SQLite, one DELETE command deletes from only one table.

Your query, as written, doesn't actually restrict the records to be deleted, so if you really want to delete all records, you would use this:

DELETE FROM Holiday;DELETE FROM Accommodation;

If you want to delete one record in the master table and all corresponding records in the child table, you just filter by that key value:

DELETE FROM Holiday       WHERE LocationID = 1;DELETE FROM Accommodation WHERE LocationID = 1;