Loading...
Three-Item Combinations
A medium SQL interview practice problem on DataDriven. Write and execute real sql code with instant grading.
- Domain
- SQL
- Difficulty
- medium
- Seniority
- mid
Problem
Given a table of items with names and costs, produce all unique 3-item combinations. For each combo, concatenate the names alphabetically separated by commas, and sum the costs. Return results ranked by total cost descending, then by name ascending.
Practice This Problem
Solve this SQL problem with real code execution. DataDriven runs your SQL queries against a live PostgreSQL database and grades it instantly.