kingberrill of SQL
7/2/2017 - 8:23 PM

ROUND()

ROUND()

-- convert US price to Gbp. current rate is 1 USD to 1.4 GBP
SELECT name, ROUND(price / 1.4, 2) as price_gbp FROM products;
SELECT ROUND(price) FROM products;

-- add argument to round to set 2 decimanl places
SELECT name, ROUND(price * 1.06,2) AS "Price in Florida" FROM products;


-- get average rating and round to 1 decimal
SELECT ROUND(AVG(rating), 0 ) AS average_rating FROM reviews;