Information Technology · Ch 5 — Database Concepts using LibreOffice Base
Queries — Using the Query Designer
Queries — Using the Query Designer
A query is a question you ask of the database to retrieve exactly the records you want — for example, 'show all customers from Pune' or 'list orders above ₹5,000'. A query does not store data of its own; it pulls the required data out of one or more tables each time it runs, and can also sort the result or perform calculations.
LibreOffice Base lets you build a query in two ways: visually with the Query Designer, or by typing SQL directly (covered in the next section). The Query Designer is a graphical, drag-and-drop screen, which makes it a good starting point.
Steps to build a query in Design View:
- In the database window, click Queries in the left panel, then Create Query in Design View....
- In the Add Table or Query dialog, choose the table(s) the query should read from, then close the dialog. The chosen tables appear at the top of the window.
- Add the fields you want in the result: double-click a field in the table, or drag it down into the design grid at the bottom. Each column of the grid represents one output field.
- For any field, use the grid rows to control the result:
- Alias — a friendlier heading for the column in the output.
- Sort — choose ascending or descending to order the result by that field.
- Visible — untick to use a field only for filtering without showing it.
- Criterion — type a condition to keep only matching rows (for example,
'Pune'under aCityfield keeps only customers from Pune;>5000under anAmountfield keeps only large orders).
- Run the query (press F5 or click the Run Query button) to see the result, then Save it with a name. …
A question asked of the database that retrieves exactly the records wanted from one or more tables; it may also sort the result or perform calculations, and i …
The graphical, drag-and-drop screen in LibreOffice Base for building a query by choosing tables, adding fields, and setting sort order and criteria w …
A condition typed under a field in the query grid that keeps only the rows matching it; criteria on the same row act as AND, o …