Information Technology · Ch 5 — Database Concepts using LibreOffice Base
Data Types and Field Properties
Data Types and Field Properties
When you create a field, you must give it a data type — a rule that fixes what kind of value the field can hold. Choosing the right data type keeps the data valid (a marks field will refuse letters), saves storage space, and lets the database sort and calculate correctly. The common data types in LibreOffice Base are:
- Integer / Small Integer / BigInt — whole numbers, such as a roll number or a quantity. Use these when no decimal part is needed.
- Decimal / Numeric — numbers with a fixed number of decimal places, ideal for money and precise amounts (for example, a price of
250.75). - Real / Float / Double — numbers with a floating decimal point, used for scientific or approximate values.
- Text (VARCHAR) — text of variable length up to a stated limit, such as a name or an address; you set the maximum length in the field properties.
- Text (fixed) (CHAR) — text of a fixed length, useful for codes that are always the same size.
- Date — a calendar date, such as a date of birth or an order date.
- Time — a time of day.
- Date/Time (Timestamp) — a date and a time together.
- Yes/No (Boolean) — a field that can hold only one of two values, such as true/false or paid/unpaid.
Below the field list, Base shows field properties that fine-tune each field. The most useful are:
- Length — the maximum number of characters (for text) or digits (for numbers).
- Decimal places — how many digits appear after the decimal point (for decimal/numeric fields).
- Default value — a value filled in automatically when a new record is added and the field is left empty.
- Entry required — set to Yes to force the field always to hold a value (it may not be left blank). A primary-key field always requires an entry. …
The rule attached to a field that fixes what kind of value it may hold — for example Integer for whole numbers, Decimal for money, Text for characters, …
A setting that fine-tunes a field, such as its length, number of decimal places, default value, whether an entry is required, …
A field property that, when set to Yes, forces the field always to contain a value so it cannot be left blank; a primary-key field m …