Number function in SQL

Number Function

  • ROUND:Round value to specify decimal.
  • TRUNC:Truncates values to specified decimal
  • MOD: Return remainder of division


Round value to specify decimal

SELECT ROUND(349.2344,2) FROM dual                         
Result value: 349.23

SELECT ROUND(349.243433) FROM dual                
Result value: 349 

SELECT ROUND(349.99) FROM dual                 
Result value: 350  
SELECT ROUND(349.50) FROM dual             
Result value: 350      


SELECT TRUNC(349.234,2) FROM dual
result value: 349.23
SELECT TRUNC(349.23) FROM dual
result value: 349


 SELECT MOD(5,2) FROM dual;
 result value: 1

query:Display employees who earns salary in even number

 SELECT last_name, salary FROM employees WHERE MOD(salary,2)=0;

Leave a Reply

Your email address will not be published. Required fields are marked *