We have already seen column aliases that allow us to rename a field's name in the query output. But we frequently encounter conditions that require changes to a field value. This is where the concept of a calculated field comes in.
9. Calculated Fields
Rahul Batra1
(1)
Gurgaon, Haryana, India
Any numeric field can be operated upon by mathematical operators we are all familiar with. We can add, subtract, multiply, divide, and even find the remainder of a division operation fairly easily. While the operators supported differ in various implementations, the ones given below should be available across any RDBMS you come across (Table 9-1).
Table ...
Get SQL Primer: An Accelerated Introduction to SQL Basics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.