Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Calculate Discounted Prices | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Functions in SQL
Sectionย 1. Chapterย 14
single

single

bookChallenge: Calculate Discounted Prices

Swipe to show menu

Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Sectionย 1. Chapterย 14
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt