#425 Albums with More Than a Given Number of Tracks

Companies:
Rosbank
Themes:
SQLAggregationPractice

Display albums whose titles start with A and that contain more than 10 tracks. The result must contain the album title and the number of tracks:

CREATE TABLE Album
(
AlbumId INTEGER NOT NULL,
Title VARCHAR(160) NOT NULL,
ArtistId INTEGER NOT NULL,
CONSTRAINT PK_Album PRIMARY KEY (AlbumId),
FOREIGN KEY (ArtistId) REFERENCES Artist (ArtistId)
);

CREATE UNIQUE INDEX IPK_Album ON Album(AlbumId);


CREATE TABLE Track
(
TrackId INTEGER NOT NULL,
Name VARCHAR NOT NULL,
AlbumId INTEGER,
UnitPrice NUMERIC(10,2) NOT NULL,
CONSTRAINT PK_Track PRIMARY KEY (TrackId),
FOREIGN KEY (AlbumId) REFERENCES Album (AlbumId)
);

CREATE UNIQUE INDEX IPK_Track ON Track(TrackId);

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in