LibreOffice Base GUI Query Design Notes
Fundamentals of Database Queries
A database query asks a question of a database. Instead of manually scrolling through every record in a table, a query pulls out exact rows and columns based on specific needs.
Core functions of a query include:
Retrieve: Fetch specific fields instead of an entire table.
Filter: Show only records that meet defined conditions (Criteria).
Sort: Arrange results in ascending or descending order.
Combine: Pull related data from more than one table simultaneously.
Conceptual Query Workflow:
Original Table Example (
Students):ID
1: Asha, Marks88ID
2: Ravi, Marks45ID
3: Meera, Marks77ID
4: Kabir, Marks39Applied Criteria:
Query Result Output:
Asha, Marks
88Meera, Marks
77

Objects in LibreOffice Base
LibreOffice Base serves as the graphical database front-end of the LibreOffice suite. It connects to a data source and provides a point-and-click interface without requiring SQL coding.
Base provides four main object types for database management:
Tables (T): Store raw data arranged in rows and columns.
Queries (Q): Ask questions of the data using criteria and filters.
Forms (F): User-friendly screens designed for data entry.
Reports (R): Formatted, printable summaries of stored data.
Interface Anatomy of Query Design View
Base's Query Design view is split into two main sections:
Table Pane (Top): Displays window boxes containing field lists for all tables selected for the query.
Design Grid (Bottom): Matrix where fields, sorting rules, output visibility, and filter criteria are configured.

Detailed breakdown of rows in the Design Grid:
Field: The selected field name from a table.
Table: The source table from which the field originates.
Sort: Controls record ordering (
Ascending,Descending, or un-sorted-).Visible: Checkbox (
✓) determining whether the field appears in the final query result table.Criteria: The row where filter conditions are typed to filter records.
Step-by-Step Procedure for Query Creation
Step 1: Open the Queries pane
In the Base main window, click Queries in the left-hand Database panel.
Step 2: Create Query in Design View
Double-click Create Query in Design View to open the query designer.
Step 3: Add table(s)
In the Add Table dialog, select one or more tables, click Add, and then click Close.
Step 4: Add fields to the grid
Double-click each required field in the table pane to drop it into the Design Grid columns.
Step 5: Set Sort & Criteria
Choose desired sort orders and type filter conditions into the Criteria row.
Step 6: Run and save
Click the Run Query icon to preview output results, then save the query under a unique name.
Single-Table Query Operations
A single-table query pulls data from only one table, filtering down to relevant fields and rows.
Worked Example Query Task: "Show me each student's Name and Class from the Students table."
Setup Steps:
Add only the
Studentstable to the Design Grid.Double-click
NameandClassto place them into grid columns.Leave
StudentID,Marks, andEmailout of the grid.Do not enter any criteria (returns all table rows).
Source Data (
StudentsTable):StudentID
101| Asha | Class10| Marks88|asha@mailStudentID
102| Ravi | Class9| Marks45|ravi@mailStudentID
103| Meera | Class10| Marks77|meera@mailQuery Output Result:
Asha | Class
10Ravi | Class
9Meera | Class
10
Sorting Query Results
Record ordering is controlled through the Sort row in the Design Grid by clicking the cell below a field name.
Ascending Sort ():
Orders values from smallest/earliest to largest/latest (, , oldest to newest date).
Example Result (Sorted Ascending by
Marks):Ravi |
45Meera |
77Asha |
88
Descending Sort ():
Orders values from largest/latest to smallest/earliest (, , newest to oldest date).
Example Result (Sorted Descending by
Marks):Asha |
88Meera |
77Ravi |
45
Multi-Field Sorting Rule: Sorting can be applied across multiple fields simultaneously; the leftmost sorted field in the Design Grid acts as the primary sort key.
Criteria Rules and Data Formatting
Criteria are conditions typed into the Design Grid to filter records, functioning identically to a
WHEREclause in SQL.Data Type Formatting Rules:
Text Values: Require enclosing double quotes (e.g., `=