3

Calculated Fields and Aliases

Keywords Introduced

AS

In the previous chapter, we talked about how to choose individual columns for inclusion in a SELECT statement. We’ll now introduce a way to perform calculations on the individual data items retrieved from a database. This technique is referred to as calculated fields. Using this approach, customer names can be transformed so they are formatted exactly as desired. Numeric calculations specific to a business or organization can be formulated and presented. In short, SQL developers are often required to customize the content of individual columns to successfully turn data into more relevant and comprehensible information. The inclusion of calculated fields is a useful device that helps accomplish ...

Get The Language of SQL, 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.