SQL practice: Numbers and Type Casting
Chapter 21 · 8 questions · included in full access
Question 1 · easy
Solve it in your browserShow each product's price rounded to a whole number.
Question 2 · easy
Solve it in your browserShow the average product price rounded to 2 decimals.
Question 3 · medium
Solve it in your browserWork out what percent of all products each category represents. (Mind the integer division.)
Question 4 · medium
Solve it in your browserShow each product's profit margin as a percentage of its selling price, rounded to 1 decimal.
Question 5 · medium
Solve it in your browserIn Postgres, dividing two integers (7 / 2) returns 3. Write a query that divides 7 by 2 to get the decimal result 3.5.
Question 6 · medium
Solve it in your browserShow each order line's total, rounded, alongside the same total rounded up to the next whole number.
Question 7 · hard
Solve it in your browserCalculate what percentage of orders are Delivered.
Question 8 · hard
Solve it in your browserShow each category's average unit price rounded to 2 decimals. It fails with 'function round(double precision, integer) does not exist'. Fix it.
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing