Home Tutorial Php Sql MySql Absolute Value

 
 

Share on Google+Share on Google+
MySql Absolute Value
Posted on: December 9, 2010 at 12:00 AM
Advertisement
This example illustrates how to find the absolute value of the table.

MySql Absolute Value

This example illustrates how to find the absolute value of the table.

In this example we use abs keywords to find the absolute value in the sql query. In the given table the column emp_value define float type when we select the abs(emp_value) then the output display below. 

 

 

 

Query

 

 select * from emp_table;

 

Output

 

+--------+----------+-----------------+-----------+
| emp_id | emp_name | emp_designation | emp_value |
+--------+----------+-----------------+-----------+
| 1      | sandeep  | programmer      | -25.88    |
| 2      | suman    | sr. Gr Designer | 0.587     |
| 3      | ravi     | s/w developer   | 91.456    |
+--------+----------+-----------------+-----------+
 

Here the absolute value display of emp_value column.

Query

 

select emp_value, abs(emp_value) from emp_table;

 

Output

 

+-----------+------------------+
| emp_value | abs(emp_value)   |
+-----------+------------------+
| -25.88    | 25.879999160767  |
| 0.587     | 0.58700001239777 |
| 91.456    | 91.456001281738  |
+-----------+------------------+

 

Advertisement

Related Tags for MySql Absolute Value:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 9, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com