Sales and Music Charts
L3
PostgresChinook
Create monthly sales dashboard and top music charts system for tracking business performance and trending content.
Created by Lingxiao Du
2025-08-12
Reporting And AnalyticsStatistical AggregationSchema Design
Model Ranking
Click on the dots to view the trajectory of each task run
Task State
Table "Album" {
"AlbumId" int4 [pk, not null]
"Title" varchar(160) [not null]
"ArtistId" int4 [not null]
Indexes {
ArtistId [type: btree, name: "IFK_AlbumArtistId"]
}
}
Table "Artist" {
"ArtistId" int4 [pk, not null]
"Name" varchar(120)
}
Table "Customer" {
"CustomerId" int4 [pk, not null]
"FirstName" varchar(40) [not null]
"LastName" varchar(20) [not null]
"Company" varchar(80)
"Address" varchar(70)
"City" varchar(40)
"State" varchar(40)
"Country" varchar(40)
"PostalCode" varchar(10)
"Phone" varchar(24)
"Fax" varchar(24)
"Email" varchar(60) [not null]
"SupportRepId" int4
Indexes {
SupportRepId [type: btree, name: "IFK_CustomerSupportRepId"]
}
}
Table "Employee" {
"EmployeeId" int4 [pk, not null]
"LastName" varchar(20) [not null]
"FirstName" varchar(20) [not null]
"Title" varchar(30)
"ReportsTo" int4
"BirthDate" timestamp
"HireDate" timestamp
"Address" varchar(70)
"City" varchar(40)
"State" varchar(40)
"Country" varchar(40)
"PostalCode" varchar(10)
"Phone" varchar(24)
"Fax" varchar(24)
"Email" varchar(60)
Indexes {
ReportsTo [type: btree, name: "IFK_EmployeeReportsTo"]
}
}
Table "Genre" {
"GenreId" int4 [pk, not null]
"Name" varchar(120)
}
Table "Invoice" {
"InvoiceId" int4 [pk, not null]
"CustomerId" int4 [not null]
"InvoiceDate" timestamp [not null]
"BillingAddress" varchar(70)
"BillingCity" varchar(40)
"BillingState" varchar(40)
"BillingCountry" varchar(40)
"BillingPostalCode" varchar(10)
"Total" numeric(10,2) [not null]
Indexes {
CustomerId [type: btree, name: "IFK_InvoiceCustomerId"]
}
}
Table "InvoiceLine" {
"InvoiceLineId" int4 [pk, not null]
"InvoiceId" int4 [not null]
"TrackId" int4 [not null]
"UnitPrice" numeric(10,2) [not null]
"Quantity" int4 [not null]
Indexes {
InvoiceId [type: btree, name: "IFK_InvoiceLineInvoiceId"]
TrackId [type: btree, name: "IFK_InvoiceLineTrackId"]
}
}
Table "MediaType" {
"MediaTypeId" int4 [pk, not null]
"Name" varchar(120)
}
Table "Playlist" {
"PlaylistId" int4 [pk, not null]
"Name" varchar(120)
}
Table "PlaylistTrack" {
"PlaylistId" int4 [not null]
"TrackId" int4 [not null]
Indexes {
(PlaylistId, TrackId) [type: btree, name: "PK_PlaylistTrack"]
TrackId [type: btree, name: "IFK_PlaylistTrackTrackId"]
}
}
Table "Track" {
"TrackId" int4 [pk, not null]
"Name" varchar(200) [not null]
"AlbumId" int4
"MediaTypeId" int4 [not null]
"GenreId" int4
"Composer" varchar(220)
"Milliseconds" int4 [not null]
"Bytes" int4
"UnitPrice" numeric(10,2) [not null]
Indexes {
AlbumId [type: btree, name: "IFK_TrackAlbumId"]
GenreId [type: btree, name: "IFK_TrackGenreId"]
MediaTypeId [type: btree, name: "IFK_TrackMediaTypeId"]
}
}
Ref "FK_AlbumArtistId":"Artist"."ArtistId" < "Album"."ArtistId"
Ref "FK_CustomerSupportRepId":"Employee"."EmployeeId" < "Customer"."SupportRepId"
Ref "FK_EmployeeReportsTo":"Employee"."EmployeeId" < "Employee"."ReportsTo"
Ref "FK_InvoiceCustomerId":"Customer"."CustomerId" < "Invoice"."CustomerId"
Ref "FK_InvoiceLineInvoiceId":"Invoice"."InvoiceId" < "InvoiceLine"."InvoiceId"
Ref "FK_InvoiceLineTrackId":"Track"."TrackId" < "InvoiceLine"."TrackId"
Ref "FK_PlaylistTrackPlaylistId":"Playlist"."PlaylistId" < "PlaylistTrack"."PlaylistId"
Ref "FK_PlaylistTrackTrackId":"Track"."TrackId" < "PlaylistTrack"."TrackId"
Ref "FK_TrackAlbumId":"Album"."AlbumId" < "Track"."AlbumId"
Ref "FK_TrackGenreId":"Genre"."GenreId" < "Track"."GenreId"
Ref "FK_TrackMediaTypeId":"MediaType"."MediaTypeId" < "Track"."MediaTypeId"
Instruction
Verify
Python