30 lines
397 B
SQL
30 lines
397 B
SQL
BEGIN
|
|
UPDATE artists
|
|
SET
|
|
total_plays = total_plays - 1
|
|
WHERE
|
|
name_string = OLD.artist_name;
|
|
|
|
UPDATE albums
|
|
SET
|
|
total_plays = total_plays - 1
|
|
WHERE
|
|
name = OLD.album_name
|
|
AND artist_name = OLD.artist_name;
|
|
|
|
UPDATE genres
|
|
SET
|
|
total_plays = total_plays - 1
|
|
WHERE
|
|
id = (
|
|
SELECT
|
|
genres
|
|
FROM
|
|
artists
|
|
WHERE
|
|
name_string = OLD.artist_name
|
|
);
|
|
|
|
RETURN OLD;
|
|
|
|
END;
|