Correct calculations
You prompted the AI assistant to help with a calculation, but it used a field cost
that doesn't exist in the PoweredHomes database. You need to replace it with the correct field to complete the operation of subtracting cost from price.
Use what you've learned about data types and prompting to fix the query.
Keep an eye on the output, something odd happens to the field name. We'll learn how to fix it next.
This exercise is part of the course
Introduction to SQL with AI
Exercise instructions
- Correct the query so that it subtracts the
unit_cost
from price.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT product_name, unit_price - cost
FROM products;