I am in this situation: I have two tables, where one is the table containing a list of songs, the other contains a list of artists.
Each row of the song table contains a reference to one artist (one row of the artist table).
I would like to write a trigger that, after an update or after a deletion on the songs table, checks if an artist is not referenced by any song any more and delete it in case it is necessary. This way I can have a clean database where I have no unused artists. Is this possible? How can I accomplish this?
Thanks!
I am in this situation: I have two tables, where one is the table
Share
of course it is possible 😉
I don’t know the exact syntax for sqlite, but try this :