How to Create Database Tables Using BASE

A Tutorial for Creating a Table in with OpenOffice.org BASE

2 Comments
Join the Conversation
Figure 1: The Main Database Window. - B. W. Vittum
Figure 1: The Main Database Window. - B. W. Vittum
This example shows how to create a simple address book. This database can be created in under ten minutes by a user with little to no experience using OpenOffice.org BASE

Once a database is created in OpenOffice.org BASE, tables need to be created in order to store the data. This example shows how to store a list of names, addresses, and phone numbers; an address book. This is one of the simplest of databases and, using OpenOffice.org BASE, can be created in under ten minutes by a user with little to no experience.

How to Create a Database Table Using BASE:

With the Tables icon highlighted in the left, click Create Table in Design View… on the right hand of the window. In Design view the fields for tables are created manually. [Figure 1]

Each row in this screen [Figure 2] is a field in the database table. Click the Field Name cell and enter names for each data field to create. Using the simple phone book example there will be four rows or fields:

  1. Field Name: Index; Field Type: Integer [INTEGER]*; Description: Primary key for the Database.
  2. Field Name: Name; Field Type: Text [VARCHAR]; Description: Name of the person in the database.
  3. Field Name: Address; Field Type: Text [VARCHAR]; Description: Address of the person in the database.
  4. Field Name: Phone; Field Type: Text [VARCHAR]; Description: Phone Number of the person in the database.

*(Field Types are drop-down selections of all available kinds of information stored in the database. Once a cell for the Field Type is clicked in, an arrow appears, clicking that are will show the drop-down.)

After this data has been entered, a few things should be explained, and done, to finalize the table for data entry..

Setting A Primary Key;

  1. Right click in the box to the left of the Field Name Index and select Primary Key from the context menu,
  2. Set to drop down option in Field Properties for AutoValue to yes. [Figure 3]

A quick note on primary keys. BASE, like most databases, needs a primary key to edit or access table data. A primary key is a unique identifier for each record allowing BASE to know exactly which row to return results from, or effect when the database receives an instruction.

Setting the Field Type to Integer {INTEGER} tells the database to only allow numerical data in this column and setting the AutoValue to yes means the database will generate these numbers, or values, automatically. The is a two-fold benefit here, there is one less piece of data-entry for the user, and it eliminates possible mistakes through gaps or attempted duplicate entries.

Setting A Table Row for Text;

  1. Fields two through four are all set with a Field Type of Text [VARCHAR],
  2. Set the Field Properties in the bottom portion of the screen Length at 255; the maximum number of characters allowed for this Field Type. [Figure 4]
  3. Click File → Save to save the table just created.

At this point the only thing that remains is to start populating the table with data. This could be done through an interface much like the one used to design the table – but a form be much simpler.

Brendan W. Vittum :: A study in musing., Brendan W. Vittum

Brendan Vittum - Brendan W Vittum is a Freelance Author & Hardware & Software Support Consultant. Mr. Vittum specializes in writing technical and ...

rss
Advertisement
Leave a comment

NOTE: Because you are not a Suite101 member, your comment will be moderated before it is viewable.
Submit
What is 2+6?

Comments

Apr 28, 2009 7:09 PM
Guest :
Good article, thanks.
Dec 20, 2009 8:44 AM
Guest :
good article.. Thanks really informative.
@andre : and nice comment also
2 Comments
Advertisement
Advertisement