How to remove the decimal point of SUM in SQL: Use the ROUND() function: ROUND(SUM(expression), decimal_places) to retain 0 decimal places: ROUND(SUM(salary), 0) Round to the nearest integer ROUND () function only affects the display of query results and does not affect the data in the table. Permanently delete the decimal point: ALTER TABLE employee ALTER COLUMN salary TYPE INT
## Removed in SQL SUM decimal point
In SQL, you can remove the decimal point from the SUM calculation result by using the ROUND() function.Syntax:
<code>ROUND(SUM(expression), decimal_places)</code>Among them:
Usage example:
<code class="sql">SELECT ROUND(SUM(salary), 0) AS total_salary FROM employee;</code>This query will calculate the sum of the salary column in table employee and round the result to the nearest integer.
Note:
<code class="sql">ALTER TABLE employee ALTER COLUMN salary TYPE INT;</code>This will change the data type of the salary column to integer, thereby permanently removing the decimal point.
The above is the detailed content of How to remove the decimal point from sum in sql. For more information, please follow other related articles on the PHP Chinese website!