0
0
SQLquery~10 mins

SELECT with expressions and calculations in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select the total price by multiplying quantity and price_per_unit.

SQL
SELECT quantity * [1] AS total_price FROM orders;
Drag options to blanks, or click blank then click option'
Acost
Btotal
Cprice_per_unit
Damount
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that does not exist in the table.
Forgetting to multiply quantity by the price per unit.
2fill in blank
medium

Complete the code to calculate the discounted price by subtracting discount from price.

SQL
SELECT price - [1] AS discounted_price FROM products;
Drag options to blanks, or click blank then click option'
Atax
Bcost
Cfee
Ddiscount
Attempts:
3 left
💡 Hint
Common Mistakes
Subtracting tax instead of discount.
Using a column that increases price instead of decreasing.
3fill in blank
hard

Fix the error in the code to calculate the total cost including tax.

SQL
SELECT price + price * [1] AS total_cost FROM sales;
Drag options to blanks, or click blank then click option'
Atax_rate
Bfee
Cdiscount
Dcost
Attempts:
3 left
💡 Hint
Common Mistakes
Using discount instead of tax rate.
Using a column that does not represent a percentage.
4fill in blank
hard

Fill both blanks to calculate the final price after applying discount and adding tax.

SQL
SELECT price - [1] + price * [2] AS final_price FROM invoices;
Drag options to blanks, or click blank then click option'
Adiscount
Btax_rate
Cfee
Dcost
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping discount and tax_rate in the expression.
Using fee or cost instead of discount or tax_rate.
5fill in blank
hard

Fill all three blanks to select the product name, calculate total revenue, and filter for revenue greater than 1000.

SQL
SELECT product_name, quantity * [1] AS total_revenue FROM sales WHERE quantity * [2] [3] 1000;
Drag options to blanks, or click blank then click option'
Aprice_per_unit
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using different columns for revenue calculation in SELECT and WHERE.
Using '<' instead of '>' in the WHERE clause.