Starting with Tables in OpenOffice Base

When you create a new database using OpenOffice base, you will need to setup one or more tables to store and organise your data. If you are already familar with other database systems, like MySQL or PostgreSQL, you already how to use tables and should be able to do this part yourself. If you wish, you can always use the wizard to create a table. However, I usually prefer to create it “manually” (note, there is nothing wrong with using the wizard, if you prefer to use it). To start creating tables, select Tables and then Create Table In Design View.

Initial Screen

This should bring up an empty table.

Table Editor

The table for editing your own data table.

To fill in the table, you first have to know which information you wish to store in the table. For example, if the database is storing information about the members of a club, it could be storing information about a person and for each person, you want to store their first and last names, their date of birth and their contact number. Each row in the table corresponds to one of this attributes. They must be assigned a name and a type. The type determines what kind of information may be stored in the field. For example, a name could be a text and the date of birth is a date. Once you have decided all of this, filling the table should be straight forward. Here is a table containing the information in the example just mentioned:

Data Table Example

A data table for storing a person's details.

The field properties at the bottom provides options that may be specific to a field. The fields in the properties should be self explanatory and there is a short description of the fields in the bottom right corner, if you require it.

When you save the new table for the first time, you will be asked to name the table and, if you have not selected a primary key, whether you want primary key to be automatically created or not. The primary key will uniquely identify the each row in the table (or each “record” you make). For this reason, the data in the primary key column can NOT contain dulplicates. If you let OpenOffice create a primary key for you, it will insert an ID column that is simply an Integer field that autoincrements. If prefer, you can select your own primary key. To make a field the primary key, right click on the cell next to the next to the field name to bring up the context menu and select “primary key”. The primary key is marked with the key icon.

Single primary key.

Making a field the primary key. The primary key field is then marked with a key.

If you have a combination of fields that, when combined, form unique a combination you can also make the combination the primary key. For example, consider a table of people that contains the first and last names of each person. Now, lets say the first entry in the table is John Smith (ie John is entered as the first name and Smith as the last name). The next entry could be John Doe or Wayne Smith, since the last name and first names, respectively, do match the any of the other entries. However, there can not be another John Smit entry in the table. To make a combination of fields a primary key, select the fields before right clicking to make them the primary key.

Combination Primary Key

Once the table has been set up, you can reopen the table to start filling the database with data. Back on the database screen, open the table where you want to insert the data. Simply enter the data as you would normally do for a spreadsheet.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: