4.2.1.4 Numeric Functions

Query 24:

SELECT qty, ROUND(qty/2,0) "qty supplied"

FROM ord_items

WHERE item#='HW2';

Query 24 - Result:

Qty ROUND(Qty/2,0)
10 5
25 13



Query 25:

SELECT qty, TRUNC(qty/2,0) "qty supplied"

FROM ord_items

WHERE item#='HW2';

Query 25 - Result:

Qty TRUNC(Qty/2,0)
10 5
25 12



Examples of Numeric Functions

MOD(n,m)

SQRT(n)

ROUND(n,m)

TRUNC(n,m)

'm' indicates the number of digits after decimal points in the result.
Powered by Blogger.