Rounding numbers
Sometimes in your database development, you may need to round the results of a calculation. There are three functions you can use for this:
CEILING(expression): rounds-up to the nearest integer valueFLOOR(expression): rounds-down to the nearest integer valueROUND(expression, length): rounds the expression to the specified length.
In this exercise, you will get familiar with the rounding functions, by applying them on a query based on the ratings table.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Functions for Manipulating Data in SQL Server
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
SELECT
rating,
-- Round-up the rating to an integer value
___(___) AS round_up
FROM ratings;