The DELETE
statement does not support a "cascade" keyword (which is clearly documented in the manual)
You need to setup the foreign key constraint to cascade deletes:
create table playlist
(
id integer primary key not null,
... other columns ...
);
create table playlistmovies
(
id integer primary key not null,
playlist_id integer not null,
... other columns
);
alter table playlistmovies
add constraint fk_plm_playlist
foreign key (playlist_id) references playlist(id)
on delete cascade;
Then when you delete a playlist, all rows referencing that playlist are also deleted.