Three-Flower Bouquet Costs
Problem
A florist stocks single stems in `Stems`, each with a per-stem `price`. A signature bouquet uses exactly **three different stems**. List the cost of every possible three-stem bouquet. Within each bouquet the stem names must appear in alphabetical order, separated by commas, and no stem may repeat. Output `bouquet` (the comma-joined names) and `total_price` (the rounded sum of the three prices, to 2 decimals). Order by `total_price` descending, then `bouquet` ascending.
Tables
Example rows — the live problem includes the full dataset.
| stem_name | price |
|---|---|
| Rose | 1.2 |
| Tulip | 0.8 |
| Lily | 1.5 |
Expected output
Your answer should return 4 rows with the columns bouquet, total_price.
Starter code (SQL)
SELECT *
FROM Stems;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock