Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Calculate Discounted Prices | Numeric Functions
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Functions in SQL

bookChallenge: Calculate Discounted Prices

Opgave

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, and discount from the products table.
  • Calculate the discounted price as price - discount for each product.
  • Round the discounted price to two decimal places.
  • Include the calculated value as a column named discounted_price in the result set.
  • Return one row for each product.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 2
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

bookChallenge: Calculate Discounted Prices

Stryg for at vise menuen

Opgave

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, and discount from the products table.
  • Calculate the discounted price as price - discount for each product.
  • Round the discounted price to two decimal places.
  • Include the calculated value as a column named discounted_price in the result set.
  • Return one row for each product.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 2
single

single

some-alt