Ad Banner Placeholder
Cambridge IGCSE Computer Science · 0478
Topic 9: Databases — Part 2
Data Types in Databases
Data types
Every field in a database table must have a data type that defines what kind of value it can store. Choosing the correct data type ensures data is stored efficiently and allows the database to perform appropriate operations — for example, adding numeric values or sorting dates.
The table below shows the main data types used in Cambridge IGCSE, with examples from a Car Dealership database:
| Data type | Description | Car Dealership example |
|---|---|---|
| Text / Alphanumeric | Stores letters, numbers, and symbols; not used for calculations | ModelName: "Mustang GT", "X5" |
| Character | Stores a single letter, digit, or symbol | FuelType: 'P' (Petrol), 'D' (Diesel) |
| Boolean | Stores one of two values: TRUE or FALSE | IsElectric: TRUE, FALSE |
| Integer | Whole numbers only (positive or negative) with no decimal part | Mileage: 45000, 12000 |
| Real | Numbers that include a fractional or decimal part | EngineSize: 1.6, 2.5, 4.0 |
| Date / Time | Stores calendar dates and/or times in a standard format | ServiceDate: 12/06/2026 |
The Cars table below shows how each field uses its data type:
| CarID (PK) | ModelName | FuelType | IsElectric | Mileage | EngineSize | ServiceDate |
|---|---|---|---|---|---|---|
| C001 | Focus | P | FALSE | 45000 | 1.6 | 15/03/2026 |
| C002 | Civic | D | FALSE | 12000 | 2.0 | 12/06/2026 |
| C003 | Model 3 | P | TRUE | 8000 | 0.0 | 01/01/2026 |
0/15
Ad Banner Placeholder