April 2026
Beginner
493 pages
23h 2m
English
In this section, we’ll review mathematical functions in DQL. These are useful for running calculations and using the numerical results however necessary. We’ll go over significant math functions and review examples together.
Let’s get the obvious out of the way first. Basic math operators for addition, subtraction, multiplication, and division are naturally supported by DQL. These operators are, in the same order, +, -, *, and /. Listing 7.121 showcases a demonstration in which multiple math operations are used together to calculate VAT amounts.
SELECT invoice_id, invoice_item_no, amount, vat_rate, amount * (vat_rate / 100) AS vat_amtFROM invoice_item;
Listing 7.121 Math Operators ...
Read now
Unlock full access