Understanding Databases Lessons
Key Concepts A database is a collection of data stored in tables to be easily accessed, managed, and updated. Examples might be a shop’s stock inventory or airline booking system. Tables are split up into records (rows) and fields (columns) A database offers more complex ways of using data than spreadsheets and data can be…
Read MoreOpen a database application To start LibreOffice Base, search from the ‘Start’ menu or find the LibreOffice folder and click the LibreOffice Base icon. Open an existing database To open an existing database, choose the option ‘open an existing database file’ from the wizard, which is the first screen you see. Choose a file from…
Read MoreAND A logical operator that is used in queries to state that values must satisfy all of the set criteria. Autovalue A feature that can be attributed to data under a certain field (often the primary key) of a table that will automatically create a unique number for each entry. Best used with ‘integer’ data…
Read MoreTables Tables are used to store records (pieces of data) within a database. Records are entered into tables under fields that are created when editing the table. Fields are similar to the headings given to columns in a spreadsheet. An unlimited number of tables can be created in a database, containing different types of data.…
Read MoreView a table in design mode Right click the table, query, form or report in the relevant area and select ‘Edit’ This will open the table, query, form or report in a design mode window Navigate between records in a table, query, form Use the navigation toolbar to navigate between records in a table, query…
Read MoreAdd or delete records in a table To add a record, click a cell in the table. Enter valid data into the cell, for instance, for Start Date, make sure you enter it in a date format. If you move down to the next row, and the ID is set to Integer auto-value, the next…
Read MoreCreate a table To create a table, click ‘Tables’ in the Database area. Then click ‘Create Table in Design View’ from the Tasks area to open table design window. In this example, we’re going to create a table that holds data on company employees. It will contain basic details on employees such as name, gender,…
Read MoreSet a field as primary key To set the primary key, right-click the grey box to the left of the field you want to set as primary key. Check the ‘Primary Key’ option and a yellow key symbol will appear in the grey box. It’s a good idea to set the primary key to an…
Read MoreUse the search command to find specific data in a field This tutorial demonstrates how to find specific records within a table. This won’t cover forms or reports, which can do the same thing but display the data in a different (more user-friendly) format. Sometimes you may want to just quickly check data within a…
Read MoreQueries are used to extract and analyse data from tables. Click on the Queries icon, then select Create Query in Design View. The single table query will use the ‘Company employees’ table created in a previous tutorial. In the ‘Add Table or Query’ window, click the table(s) you want to extract data from, click ‘Add’,…
Read MoreTo create a two-table query, first make sure you have created a second table. The two-table query will use the ‘Company employees‘ table created in a previous tutorial. Use the table design view to create a table containing personal phone numbers for home and mobile Once created and saved, you need to create a relationship…
Read MoreChange arrangement of data fields and headings in a report Click ‘Reports’ from the Database area of the main window and right click the report you want to change in the Reports area. Click ‘Edit’ from the drop down menu. To move fields and labels, simply click and drag individually to move them around the…
Read MoreAdd criteria to a query using ‘NOT’ logical operator From the Queries area of the main window, right click the query and click ‘Edit’. In the Criterion row, add criteria that uses the ‘NOT’ logical operator, e.g. in Description field type “NOT=‘Home’”. This will return any data that has a description not equal to Home,…
Read MoreEdit a query: add, modify, remove criteria Click the criteria you want to modify or remove, highlight it then press delete to remove or type to modify it. To add criteria in another field, simply click on the Criterion cell under the field name and type the criteria. To remove a field, right click the…
Read MoreUnderstand that a form is used to display and maintain records. Forms display records one at a time in a format that can be customized. Rather than reading the data from a table, it can be laid out in a way to suit your needs. Forms provide a way for users of the database to…
Read MoreThe simplest way to create a new form is to use the ‘Wizard’. Click the ‘Forms’ section in the Database area of the main window and select ‘Use Wizard to Create Form’ from the Tasks area. Use the drop-down menu to choose the table you want to display. Select the fields you want to display…
Read MoreUse a form to insert new records To insert a new record, click the ‘New Record’ icon on the form navigation toolbar. You can enter the data straight into the field boxes on the form. Note that if you have set the ID to an integer in the table, this will generate the value automatically…
Read MoreUnderstand that a report is used to print from a table or query Reports are used to extract data from a table or query, by exporting to a printable text file. It can be saved and run again if more reports are created or data is modified. Because database reports simplify and filter the records…
Read MoreCreate and name a report based on a table or query Begin by clicking ‘Reports’ in the Database area of the main window, then click ‘Use Wizard to Create Report’ from the Tasks area. In the Report Wizard window, select the desired table or query from the drop down menu. Select the fields that you…
Read MoreEither create a new report through the wizard or edit an existing report in Report Design View. To group fields, click on the ‘Sorting and Grouping’ icon on the toolbar. Grouping fields will stop information from being duplicated, for instance if the same person has a home and mobile number stored in the database. Select…
Read MorePresent specific fields in a grouped report For this section, create a new table to display salary and another to display bonuses. This data will require a grouped report to display correctly as there are multiple entries for employee-ID. Next, we need to create a relationship, in the main window, click ‘Relationships’ from the ‘Tools’…
Read MorePresent specific fields in a grouped report by sum The ‘sum’ function will add together all the records in a specified field. Therefore, the sum function can only be applied to numerical fields. Reports allow you to present fields as a sum without having to create a query to include the function. An accounts database…
Read MorePresent specific fields by maximum or minimum You can present fields in a report using maximum or minimum functions, again without the need for a query. The function is applied directly to the field to either display the minimum or maximum value from the records. Therefore, it can only be used on numerical values. An…
Read MoreIn LibreOffice Base, the simplest way to present specific fields using average or count functions is to create a query first. Average will return the mean average of the field, therefore it requires numerical data. Mean average is calculated by finding the sum total of all the records, divided by the count (the number of…
Read MoreAdd, modify text in headers, footers in a report. Open a report in design view, by right clicking the report in the main window and selecting edit. To add text to a header or footer, first click ‘Label Field’ from the toolbar. Click and drag where you want to place the text. With the label…
Read MoreExport a table, query output in spreadsheet or text Open a table or query by double clicking from the main window. Select File -> New -> Spreadsheet to open a new Libreoffice Calc spreadsheet. Minimize the spreadsheet for now. To export all records, left click the grey box in the top left corner of the…
Read MoreChange the orientation and paper size Orientation is the format in which the page displays, either in portrait mode where the page is displayed with the long edge vertical, or landscape, where the longer edge is horizontal. To change the orientation, select either Portrait or Landscape. To change the orientation, select either Portrait or Landscape.…
Read MoreRelated Lessons
This lesson provides an overview of the database functions available in the ‘Function Wizard’. We learned about ‘DSUM’, a function that adds up all the cells in a data range which match a certain search criterion.
Advanced Spreadsheets – Database Functions