SQL: Mathematical Operators + , - , * , /
As you may have guessed the SQL mathematical operators are equivalent to their regular mathematical counter parts.
- + Addtion
- - Subtraction
- * Multiplication
- / Division
Eamples:
SELECT UnitPrice, (UnitPrice + 20) AS RipOffPrice2. Subraction
FROM Products
SELECT UnitPrice,(UnitPrice - 5) AS OutOfBusinessPrice3. Muliplication
FROM Products
WHERE UnitPrice BETWEEN 5 AND 10
SELECT UnitPrice,(UnitPrice*UnitsInStock) AS InventoryPrice4. Division
FROM Products
SELECT UnitPrice,(UnitPrice/2) AS HalfPrice
FROM Products
Comments
Post a Comment