Chapter 3. Numeric Data in SQL

SQL IS NOT A computational or procedural language; the arithmetic capability of SQL is weaker than that of any other language you have ever used. But there are some tricks that you need to know when working with numbers in SQL and when passing them to a host program. Much of the arithmetic and the functions are defined by implementations, so you should experiment with your particular product and make notes on the defaults, precision, and tools in the math library of your database.

You should also read Chapter 21, which deals with the related topic of aggregate functions. This chapter deals with the arithmetic that you would use across a row, instead of down a column; they are not quite the same.

Get Joe Celko's SQL for Smarties, 3rd Edition 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.