4.2.1.3 Date Arithemetic Arithmetic Expressions
Arithmetic Expressions
| + - * / ( ) |
Arithmetic functions are allowed in SELECT and WHERE clauses.
SELECT descr, price, price*0.1 "discount"
FROM items
WHERE price >= 4000
ORDER BY 3;
Query 22 - Result:
| Descr | Price | Discount |
| Power Supply | 4000 | 400 |
| MS-DOS 6.0 | 5000 | 500 |
| MS-Word 6.0 | 8000 | 800 |
SELECT descr
FROM items, ord_items
WHERE price*qty > 250000
and items.item# = ord_items.item#;
Query 23 - Result:
| Descr |
| Power Supply |
| MS-DOS 6.0 |
| MS-Word 6.0 |
Date Arithemetic
| Date + No. of days Date - No. of days Date – Date |
Query 26:
SELECT ord#, orddate+15 "Supply by"
FROM ord_aug;
Query 26 - Result:
| Ord# | Supply by |
| 101 | 17-AUG-94 |
| 102 | 26-AUG-94 |
| 103 | 05-SEP-94 |
| 104 | 12-SEP-94 |
| 105 | 14-SEP-94 |
Leave a Comment