Count Distinct Over Partition

Table Used: InvoiceLine

Objective: The participant is required to count the distinct tracks associated with each invoice.

Details:

  • Output Columns:
    1. InvoiceId
    2. DistinctTracksCount - Represents the number of unique tracks for each invoice.
  • Write an SQL query to retrieve the above columns from the InvoiceLine table.
  • Ensure that you're counting only distinct tracks for each invoice.
  • Order: The result should be ordered by InvoiceId.

Expected Columns in Result:

  • InvoiceId
  • DistinctTracksCount
Adding your container request
Getting your dedicated container
Connecting to your container
Setting up your editor
Finalizing your playground
TerminalEditorBrowser