In a database (or spreadsheet) you can change how a numeric value is shown without changing the value that is stored. This is essential for:
| Data type | Typical use | Notes for the syllabus |
|---|---|---|
Number | Quantities, measurements, scores | Can be defined as integer (no decimal places) or floating‑point (decimal places). Choose the type that matches the real‑world data. |
Currency | Prices, salaries, budgets | Automatically supplies a default currency mask (e.g. "$"#,##0.00). The mask can be changed to any required symbol. |
Percentage | Proportions, rates, growth figures | Stores the decimal (e.g. 0.375) and displays it as a percentage. |
When you create a table you must select the appropriate data type for each field. The chosen type determines which display masks are available in the field’s Properties → Format (or Number) tab.
A display mask (also called a format mask) tells the DBMS how to present the stored numeric value. The mask does not alter the underlying data; it only changes the visual representation.
| Symbol | Meaning |
|---|---|
0 | Digit placeholder – forces a zero to appear if no digit is present. |
# | Digit placeholder – hides insignificant zeros. |
. | Decimal point. |
, | Thousands separator. |
"$", "£", "€" | Literal currency symbol. |
% | Percentage – multiplies the underlying value by 100 and appends “%”. |
"text" | Literal text – appears exactly as typed. |
; positiveMask ; negativeMask | Separate masks for positive and negative numbers (e.g. 0.00;‑0.00 shows a minus sign for negatives). |
Note: The syllabus allows any hardware platform, operating system and application, so the same steps apply to MySQL Workbench, Microsoft SQL Server Management Studio, or other tools that expose a format‑mask field.
| Mask | Result for 123.4567 |
|---|---|
0 | 123 |
0.0 | 123.5 |
0.00 | 123.46 |
0.000 | 123.457 |
#.## | 123.46 (no trailing zeros) |
0.00;‑0.00 | Shows a minus sign for negative numbers (e.g., –123.46). |
| Mask | Result for 2500 |
|---|---|
"\$"#,##0 | \$2,500 |
"£"#,##0.00 | £2,500.00 |
"€"#,##0.00 | €2,500.00 |
#,##0.00 "USD" | 2,500.00 USD |
"\$"#,##0.00;‑"\$"#,##0.00 | Shows a minus sign for negative amounts (e.g., –$2,500.00). |
| Mask | Stored value | Displayed result |
|---|---|---|
0% | 0.375 | 38% |
0.0% | 0.375 | 37.5% |
0.00% | 0.375 | 37.50% |
0.0%;‑0.0% | -0.125 | -12.5% |
$12.50 is still stored as 12.5 for any query or expression."£"#,##0.00 will sort correctly from smallest to largest.WHERE Price > 1000 works even if the field displays £1,200.00. Common pit‑fall: WHERE Price > "\$1000" fails because the literal “\$” is not part of the stored data.
When a field is calculated, the DBMS uses the underlying numbers, then applies the mask you assign to the result field.
-- Example in Access (Query Design)TotalPrice: [Quantity] * [UnitPrice]
-- Field definitions
Quantity – Number (integer, format: 0)
UnitPrice – Currency (format: "$#,##0.00")
TotalPrice – Currency (format: "$#,##0.00")
Even if UnitPrice is shown as $12.50, the calculation uses the exact stored value 12.5. The result TotalPrice is then displayed with the chosen currency mask.
| Symbol | Meaning |
|---|---|
0 | Digit placeholder – displays a zero if no digit is present. |
# | Digit placeholder – does not display extra zeros. |
. | Decimal point. |
, | Thousands separator. |
"$", "£", "€" | Literal currency symbol. |
% | Percentage – multiplies the underlying value by 100 and appends %. |
"text" | Literal text – appears exactly as typed. |
; positiveMask ; negativeMask | Separate masks for positive and negative numbers (e.g., 0.00;‑0.00). |
9876.543 and apply three different formats:49.9. Show the displayed result when the format mask is "£"#,##0.00.0.25 to a percentage format with zero decimal places. Include the effect on any calculations that use this cell.Quantity (Number) and UnitPrice (Currency). Create a calculated field Total (Currency) that multiplies the two. Show:Total.Quantity = 8 and UnitPrice = £12.50.Cost is defined as Number with the mask 0.00. Change its data type to Currency and set the mask to "$"#,##0.00. Then re‑run a query that sums Cost. Explain:0 to force digits, # to hide unnecessary zeros, , for thousands, and literal symbols for currency or text. Include a negative‑number mask (positiveMask;‑negativeMask) when required.Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.