Challenge: Calculate Discounted Prices
Uppgift
Swipe to start coding
Write a query to calculate the discounted price for each product. The discounted price should be the original price minus the discount, rounded to two decimal places.
- Select the columns
product_id,name,price, anddiscountfrom theproductstable. - Calculate the discounted price as
price - discountfor each product. - Round the discounted price to two decimal places.
- Include the calculated value as a column named
discounted_pricein the result set. - Return one row for each product.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 2
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Fantastiskt!
Completion betyg förbättrat till 2.86
Challenge: Calculate Discounted Prices
Svep för att visa menyn
Uppgift
Swipe to start coding
Write a query to calculate the discounted price for each product. The discounted price should be the original price minus the discount, rounded to two decimal places.
- Select the columns
product_id,name,price, anddiscountfrom theproductstable. - Calculate the discounted price as
price - discountfor each product. - Round the discounted price to two decimal places.
- Include the calculated value as a column named
discounted_pricein the result set. - Return one row for each product.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 2
single