Arithmetic Operators - SQL
Arithmetic Operators - SQL
ARITHMETIC OPERATORS
SQL
• Plus (+)
• Minus (-)
• Divide (/)
• Multiply (*)
• Modulo (%)
– returns the integer remainder of a division
The modulo operator does not work
with data types that have decimals.
102 % 5 = 2
2 * 6 +9 / 3
evaluated as
12 + 3 = 15
However,
2 * (6 + 9 ) / 3
evaluated as
2 * 15 / 3 = 10 MDAS
The (+) in
adds 15 cents to each price.
Thus, the query above will produce the
following results.
ANSWER
2. To subtract.
i. Subtracting one column to another
ii. Subtracting values to data.
2. To subtract.
i. Subtracting one column to another
SELECT ITEM,
WHOLESALE,
WHOLESALE * 0.9
as NEWPRICE
FROM PRICE;
Rename the
column name as
RETAIL from
WHOLESALE + 0.15
Rename the
column name as
RETAIL from
WHOLESALE + 0.15