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
Functions in SQL

bookChallenge: Calculate Discounted Prices

Oppgave

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

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 2
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

close

bookChallenge: Calculate Discounted Prices

Sveip for å vise menyen

Oppgave

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 desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 2
single

single

some-alt