Be able to align data and labels appropriately including right aligning numeric data and decimal alignment

Published by Patrick Mutisya · 14 days ago

Cambridge IGCSE ICT 0417 – Databases: Aligning Data and Labels

18 Databases

Objective

Be able to align data and labels appropriately, including right‑aligning numeric data and aligning decimal points in tables.

Why Alignment Matters

  • Improves readability of reports and printed output.
  • Helps users compare figures quickly.
  • Professional presentation is required for examinations and real‑world business documents.

Basic Alignment Rules

  1. Textual data (names, addresses, descriptions) – left‑aligned.
  2. Numeric data (quantities, prices, totals) – right‑aligned.
  3. When numbers contain decimals, align the decimal points so that the fractional parts line up vertically.

Using Tables to Align Data

In a database report you can use an HTML <table> to control alignment. The align attribute on <td> (or <th>) can be set to left, center or right. For decimal alignment, place the whole number and the fractional part in separate cells, or use a fixed‑width font and right‑align the whole cell.

Example 1 – Simple Right Alignment

ItemQuantityPrice (£)
Notebook121.50
Pen300.45
Calculator512.99

Example 2 – Aligning Decimal Points

One common technique is to split the number into two cells: the integer part (right‑aligned) and the fractional part (left‑aligned). This forces the decimal points to line up.

ProductUnitsUnit Price (£)
Whole.Fraction
Desk385.00
Chair1245.50
Lamp722.75

Using LaTeX for Calculations in Notes

When demonstrating calculations, embed LaTeX expressions between \$...\$ for inline or \$...\$ for displayed equations.

Example of a total price calculation:

\$\text{Total} = \sum{i=1}^{n} (\text{Quantity}i \times \text{Price}_i)\$

For the table above, the total for the Desk line would be:

\$\text{Total}_{\text{Desk}} = 3 \times 85.00 = 255.00\$

Practical Exercise

Create a report for the following sales data. Align the columns as described.

  1. Product: Mouse, Quantity: 15, Unit Price: 9.99
  2. Product: Keyboard, Quantity: 8, Unit Price: 24.50
  3. Product: Monitor, Quantity: 4, Unit Price: 149.95

Include a column for Subtotal (Quantity × Unit Price) and a final row for Grand Total. Use right alignment for all numeric columns and ensure the decimal points line up.

Suggested diagram: Layout of a printed sales report showing aligned columns.