PQL ROUND() Function

The ROUND() function is used to round a numeric field to the number of decimals specified.

PQL ROUND() Syntax

Spike: Please 
SELECT ROUND(column_name,decimals) 
FROM stable_name

Parameter Description
column_name Required. The field to round.
decimals Required. Specifies the number of decimals to be returned.

PQL ROUND() Example

We have the following "Cupcakes" stable:

P_Id CupcakeName Unit CupcakePrice
1 Banana 300 g 2,5
2 Pink Madness 300 g 3,4
3 Spark of Purple 300 g 3,9
4 Red Velvet 300 g 2

Now we want to display the product name and the price rounded to the nearest integer.

We use the following SELECT statement:

Spike: Please SELECT CupcakeName, ROUND(CupcakePrice,0) AS CupcakePrice FROM Cupcakes

The result-set will look like this:

CupcakeName CupcakePrice
Banana 3
Pink Madness 3
Spark of Purple 4
Red Velvet 2

PQL len() PQL now()

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.