I am struggeling with a query.
I have two tables:
CREATE TABLE Playlist(
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(255) NOT NULL,
);
CREATE TABLE PlaylistMovies(
mid INTEGER FOREIGN KEY REFERENCES Movie(movieid) ON DELETE CASCADE,
pid INTEGER FOREIGN KEY REFERENCES Playlist(id) ON DELETE CASCADE,
PRIMARY KEY (mid, pid)
);
I want to find the playlist with the most movies(counted mid`s).
How to approach this problem?
Try this out please:
Query:
Results: