Understanding Calculated Fields

Data stored within a databases tables is often not available in the exact format needed by your applications. Here are some examples:

  • City, State, and Zip are stored in separate columns (as they should be), but your mailing label printing program needs them retrieved as one correctly formatted field.

  • Column data is in mixed upper- and lowercase, and your report needs all data presented in uppercase.

  • An Order Items table stores item price and quantity, but not the expanded price (price multiplied by quantity) of each item. To print invoices, you need that expanded price.

  • You need total, averages, or other calculations based on table data.

In each of these examples, the data stored in the table is not exactly what ...

Get Sams Teach Yourself SQL in 10 Minutes 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.