TRUNCATE, Beheading Decimal Value

Syntax : TRUNCATE(decimal,digit)

In MySQL, truncate function is used to chop off a decimal fractions

Example : SELECT TRUNCATE(12.844556,3); 

 

CEILING, Rounding Decimal Numbers (Up)

Syntax : CEILING(decimal, digit)

In MySQL, the Ceiling function used to round up a decimal

Example : SELECT CEILING(12.34) AS Pembulatan;

 

ROUND, Rounding Numbers Nearby

Syntax : ROUND(decimal,digit)

 In MySQL, the Round function is used to round a number to the nearest value

Example:


SELECT ROUND(12.84,1);
SELECT ROUND(12.844556,3);

FLOOR, Rounding Decimal Numbers (Down)

Syntax : FLOOR(decimal)

In MySQL, Floor Function used for rounding down a decimal

Example : SELECT FLOOR12.84) AS Pembulatan;

SUM, Getting Value Total

Syntax : SUM(field)

In MySQL, the Sum function is used to find the total value of a field in a table

Example:
SELECT SUM(Harga) AS TotalHarga FROM Barang;
SELECT Satuan,SUM(Harga) AS TotalHarga FROM Barang GROUP BY Satuan;