Get startedGet started for free

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()).

This exercise is part of the course

Functions for Manipulating Data in SQL Server

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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;
Edit and Run Code