dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Use MySQL for Calculations

See a few different ways to use MySQL to compute the result of a mathematical formula.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


At times, when you want to compute the result of a mathematical formula, you can use MySQL to do the task. It is a great tool for this. Here are a few examples:

Query:

SELECT PI();

Output:

+------------+
| PI()       |
+------------+
| 3.141593   |
+------------+

Query:

SELECT PI() * 7;

Output:

+------------+
| PI() * 7   |
+------------+
| 21.991149  |
+------------+

Query:

SELECT 399*12/4, 6*12;

Output:

+------------+------------+
| 399*12/4   | 6*12       |
+------------+------------+
| 1197.0000  | 72         |
+------------+------------+

 

Visit the DevX Tip Bank

 





   
Sridhar M S. is a Java developer from Bangalore, India. He holds a master's degree in Computer Science.
Thanks for your registration, follow us on our social networks to keep up-to-date