เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

MINimizing and MAXimizing some results

Calculating the minimum, maximum or average value from a data set are common tasks when working with databases. You may need to calculate the maximum or minimum salary within a department or the average weight of some people going to the gym.

In this exercise, you will find out the average cocoa percentage used by each company in their chocolate bars.

You will also calculate the minimum and maximum score received by each company during the voting process.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Functions for Manipulating Data in SQL Server

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

SELECT 
	company,
	-- Calculate the average cocoa percent
	___ AS avg_cocoa
FROM ratings
GROUP BY company;
แก้ไขและรันโค้ด