SQLite delete shared row when last reference to it deleted
This is possible with a trigger.
When there are no parents with the same child left, delete the child:
CREATE TRIGGER tAFTER DELETE ON ParentWHEN NOT EXISTS (SELECT 1 FROM Parent WHERE ChildID = OLD.ChildID)BEGIN DELETE FROM Child WHERE ID = OLD.ChildID;END;