Chapter 34
Math Functions
“Ideas pull the trigger, but instinct loads the gun.”
Table of Contents Chapter 34 – Math Functions
– What is the Order of Precedents?
– What is the Answer to this Math Question?
– What is the Answer to this Math Question?
– What is the Answer to this Math Question?
What is the Order of Precedents?
Order of Precedents for Math
( ) Parenthesis
** Exponentiation
* Multiplication
/ Division
+ Addition
- Subtraction
Mathematics can be used within your Syntax. But, like any math problems, it has an Order of Precedents.
What is the Answer to this Math Question?
SELECT (2 + 4) * 5
What is the Answer?
30
This is an example of mathematics taking place with the Order of Precedents being respected.
What is the Answer to this Math Question?
SELECT 2 + 4 / 5
What is the Answer?
2
The answer to this example is 2. This is because when a decimal isn't used within the equation, the system will NOT allow for a decimal to be part of the answer set.
Instead of 2.8, it drops the decimal altogether and just gives you a 2.
What is the Answer to this Math Question?
SELECT 2 + 4.0 / 5
What is the Answer?
2.8
In order to see the decimal in your answer set, you must have at least one decimal in your equation.