Round()
Round() 함수는 숫자를 지정된 소수 자릿수로 반올림한다.
⭐ 표현식이 5로 끝나면 이 함수는 마지막 숫자가 짝수가 되도록 반올림한다.
Access 2000에서 작동한다.
반올림 예시
Round(34.55, 1) – 결과: 34.6(반올림)
Round(34.65, 1) – 결과: 34.6(내림)
형식
Round(expression, decimal_places)
매개변수
expression
:
반올림할 숫자 식
decimal_places
:
선택 사항. 식을 반올림할 소수점 자리 수. 생략할 경우 함수는 가장 가까운 정수로 반올림한다.
예제
“제품” 표에서 가격 열을 소수점 이하 1자리로 반올림해보자.
SELECT ProductName, Price, Round(Price, 1) AS RoundedPrice FROM Products;
기본 예시
ProductName | Price | RoundedPrice |
---|---|---|
Chais | 18 | 18 |
Chang | 19 | 19 |
Aniseed Syrup | 10 | 10 |
Chef Anton’s Cajun Seasoning | 22 | 22 |
Chef Anton’s Gumbo Mix | 21.35 | 21.4 |
Grandma’s Boysenberry Spread | 25 | 25 |
Uncle Bob’s Organic Dried Pears | 30 | 30 |
Northwoods Cranberry Sauce | 40 | 40 |
Mishi Kobe Niku | 97 | 97 |
Ikura | 31 | 31 |
Queso Cabrales | 21 | 21 |
Queso Manchego La Pastora | 38 | 38 |
Konbu | 6 | 6 |
Tofu | 23.25 | 23.2 |
Genen Shouyu | 15.5 | 15.5 |
Pavlova | 17.45 | 17.4 |
Alice Mutton | 39 | 39 |
Carnarvon Tigers | 62.5 | 62.5 |
Teatime Chocolate Biscuits | 9.2 | 9.2 |
Sir Rodney’s Marmalade | 81 | 81 |
Sir Rodney’s Scones | 10 | 10 |
Gustaf’s Knäckebröd | 21 | 21 |
Tunnbröd | 9 | 9 |
Guaraná Fantástica | 4.5 | 4.5 |
NuNuCa Nuß-Nougat-Creme | 14 | 14 |
Gumbär Gummibärchen | 31.23 | 31.2 |
Schoggi Schokolade | 43.9 | 43.9 |
Rössle Sauerkraut | 45.6 | 45.6 |
Thüringer Rostbratwurst | 123.79 | 123.8 |
Nord-Ost Matjeshering | 25.89 | 25.9 |
Gorgonzola Telino | 12.5 | 12.5 |
Mascarpone Fabioli | 32 | 32 |
Geitost | 2.5 | 2.5 |
Sasquatch Ale | 14 | 14 |
Steeleye Stout | 18 | 18 |
Inlagd Sill | 19 | 19 |
Gravad lax | 26 | 26 |
Côte de Blaye | 263.5 | 263.5 |
Chartreuse verte | 18 | 18 |
Boston Crab Meat | 18.4 | 18.4 |
Jack’s New England Clam Chowder | 9.65 | 9.6 |
Singaporean Hokkien Fried Mee | 14 | 14 |
Ipoh Coffee | 46 | 46 |
Gula Malacca | 19.45 | 19.4 |
Røgede sild | 9.5 | 9.5 |
Spegesild | 12 | 12 |
Zaanse koeken | 9.5 | 9.5 |
Chocolade | 12.75 | 12.8 |
Maxilaku | 20 | 20 |
Valkoinen suklaa | 16.25 | 16.2 |
Manjimup Dried Apples | 53 | 53 |
Filo Mix | 7 | 7 |
Perth Pasties | 32.8 | 32.8 |
Tourtière | 7.45 | 7.4 |
Pâté chinois | 24 | 24 |
Gnocchi di nonna Alice | 38 | 38 |
Ravioli Angelo | 19.5 | 19.5 |
Escargots de Bourgogne | 13.25 | 13.2 |
Raclette Courdavault | 55 | 55 |
Camembert Pierrot | 34 | 34 |
Sirop d’érable | 28.5 | 28.5 |
Tarte au sucre | 49.3 | 49.3 |
Vegie-spread | 43.9 | 43.9 |
Wimmers gute Semmelknödel | 33.25 | 33.2 |
Louisiana Fiery Hot Pepper Sauce | 21.05 | 21 |
Louisiana Hot Spiced Okra | 17 | 17 |
Laughing Lumberjack Lager | 14 | 14 |
Scottish Longbreads | 12.5 | 12.5 |
Gudbrandsdalsost | 36 | 36 |
Outback Lager | 15 | 15 |
Fløtemysost | 21.5 | 21.5 |
Mozzarella di Giovanni | 34.8 | 34.8 |
Röd Kaviar | 15 | 15 |
Longlife Tofu | 10 | 10 |
Rhönbräu Klosterbier | 7.75 | 7.8 |
Lakkalikööri | 18 | 18 |
Original Frankfurter grüne Soße | 13 | 13 |
참고
W3C School - SQL Round() Function
W3C School - SQL Tutorial