Brightlane's promotions team is pricing a clearance event for the end-of-season inventory cycle. One item originally priced at $120 will be discounted by 25%.
Write a query to return both the discount amount and the resulting sale price.
Output:
- A single row with two columns,
discount_amountandsale_price, in that order.
Run previews · Check grades
Write a query, then run it to see results here.
Worked solution Try it yourself first
SELECT
120 * 0.25 AS discount_amount,
120 * 0.75 AS sale_price The shape
Two comma-separated expressions in the SELECT list produce two labeled columns in a single row — the discount amount and the resulting sale price, side by side.
Clause by clause
120 * 0.25 AS discount_amountis the first expression: 25% of the original price, which is30.00. TheASalias labels the column so the value reads in the unit the analyst cares about — dollars off the original price.120 * 0.75 AS sale_priceis the second expression: the complement of the discount,90.00. Computing the sale price as120 * 0.75rather than as120 - (120 * 0.25)keeps the arithmetic flat: one multiplication instead of a multiplication plus a subtraction. Both produce the same number, but the flatter shape is easier to read at a glance.- The comma between the two expressions is what makes them sit in the same row. Each expression evaluates independently against the same conceptual input — the original price — and the row that comes back has one column per expression, in source order.
You practiced returning multiple labeled expressions in one row by separating them with commas in the SELECT list. Multi-column output via comma-separated expressions is the default shape of every multi-value query.