Manipulating numeric data
In this exercise, you are going to use some common SQL Server functions to manipulate numeric data.
You are going to use the ratings
table, which stores information about each company that has been rated, their different cocoa beans and the rating per bean.
You are going to find out information like the highest, lowest, average score received by each company (using functions like MAX()
, MIN()
, AVG()
). Then, you will use some rounding functions to present this data with fewer decimals (ROUND()
, CEILING()
, FLOOR()
).
Cet exercice fait partie du cours
Functions for Manipulating Data in SQL Server
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
SELECT
company,
-- Select the number of cocoa flavors for each company
___(*) AS flavors,
-- Select the minimum, maximum and average rating
___ AS lowest_score,
___ AS highest_score,
___ AS avg_score
FROM ratings
GROUP BY company
ORDER BY flavors DESC;