Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

OpenOffice 3.x Getting Started Guide
Previous Page Home Next Page

Using the Wizard to create a table

Image:documentation_caution.pngEvery table requires a Primary key field. (What this field does will be explained later.) We will use this field to number our entries and want that number to automatically increase as we add each entry.

Since none of the fields we need for our Automobile database are contained in any of the wizard tables, we will create a simple table using the wizard that has nothing to do with our database. This section is an exercise in explaining how the Wizard works.

The Wizard permits the fields of the table to come from more than one suggested table. We will create a table with fields from three different suggested tables in the Wizard.

Click Use Wizard to Create Table. This opens the Table Wizard.

Image:documentation_note.pngA field in a table is one bit of information. For example, in a price list table, there might be one field for item name, one for the description and a third for the price. More fields may be added as needed.

Top of page

Step 1: Select fields.

You have a choice of two categories of suggested tables: Business and Personal. Each category contains its own suggested tables from which to choose. Each table has a list of available fields. We will use the CD-Collection Sample table in the Personal category to select the fields we need.

  1. Category: Select Personal. The Sample Tables drop down list changes to a list of personal sample tables.
  2. Sample Tables: Select CD-Collection. The Available fields window changes to a list of available fields for this table.
  3. Selected Fields: Using the > button, move these fields from the Available fields window to the Selected fields window in this order: CollectionID, AlbumTitle, Artist, DatePurchased, Format, Notes, and NumberofTracks.
  4. Selected Fields from another sample table. Click Business as the Category. Select Employees from the dropdown list of sample tables. Use the > button to move the Photo field from the Available fields window to the Selected fields window. It will be at the bottom of the list directly below the NumberofTracks field.
  5. If a mistake is made in the order as listed above, click on the field name that is in the wrong order to highlight it. Use the Up or Down arrow on the right side of the Selected Fields list to move the field name to the correct position. Click Next.
Order of fields.
Image:documentation_caution.pngBelow the Selected Fields list are two buttons: one with a +, and one with a -. These buttons are used to add or to remove fields from the Selected Fields list. Be careful when using these buttons until well acquainted with how to create tables.

Top of page

Step 2: Set field types and formats.

In this step you give the fields their properties. When you click a field, the information on the right changes. You can then make changes to meet your needs. Click each field, one at a time, and make the changes listed below.

Changing field types.
Image:documentation_note.pngIf any of these fields requires an entry, set Entry required to Yes. If Entry required is set to Yes, this field must have something in it. For example if FirstName has Entry required set to Yes, having an entry with the first name missing will not be allowed. In general, only set Entry required to Yes if something must always be put in that field. By default, Entry required is set to No.
  • CollectionID: Change AutoValue from No to Yes.
  • AlbumTitle:
    • Entry required: If all of your music is in albums, change Entry required to Yes. Otherwise, leave Entry required as No.
    • Length: Unless you have an album title that exceeds 100 characters in length counting the spaces, do not change the length.
Image:documentation_note.pngIn Base the maximum length of each field must be specified on creation. It is not easy to change this later, so if in doubt specify a greater length. Base uses VCHAR as the field format for text fields. This format only uses the actual number of characters in a field up to the limit set. So, a field containing 20 characters will only use space for 20 characters even if the limit is set at 100. So, two album titles containing 25 and 32 characters respectively will use space for 25 and 32 characters and not 100 characters.
  • Artist: Use the Default setting. And since music has authors, set Entry Required to Yes.
  • Date Purchased: Length: default setting. Entry required should be No. (You may not know the date.)
  • Format: Only change the Entry Required setting: from No to Yes.
  • Notes: No changes are required.
  • NumberofTracks: Change the Field Type to Tiny Integer [TINYINT]. Your allowable number of tracks will be 999. Small Integer [SMALLINT] would allow 99999 tracks if you needed more than 999 tracks.
  • Photo: Use the default settings.

When you have finished, click Next.

Image:documentation_note.pngEach field also has a Field Type. In Base the field type must be specified. These types include text, integer, date and decimal. If the field is going to have general information in it (for example a name or a description), then you want to use text. If the field will always contain a number (for example a price), the type should be decimal or another appropriate numerical field. The wizard picks the right field type, so to get an idea of how this works, see what the wizard has chosen for different fields.

Top of page

Step 3: Set primary key.

  1. Create a primary key should be checked.
  2. Select option Use an existing field as a primary key.
  3. In the Fieldname drop down list, select CollectionID.
  4. Check Auto value if it is not already checked.
  5. Click Next.
Image:documentation_note.pngA primary key uniquely identifies an item (or record) in the table. For example, you might know two people called "Randy Herring" or three people living at the same address and the database needs to distinguish between them.

The simplest method is to assign a unique number to each one: number the first person 1, the second 2, and so on. Each entry has one number and every number is different, so it is easy to say "record ID 172". This is the option chosen here: CollectionID is just a number assigned automatically by Base to each record of this table.

There are more complex ways of doing this, all answering the question "How do I make sure that every single record in my database can be uniquely identified?"

Top of page

Step 4: Create the table.

  1. If desired, rename the table at this point. If you rename it, make the name meaningful to you. For this example, make no changes.
  2. Leave the option Insert data immediately checked.
  3. Click Finish to complete the table wizard. Close the window created by the table wizard. You are now back to the main window of the database with the listing of the tables, queries, forms, and reports.

Top of page


OpenOffice 3.x Getting Started Guide
Previous Page Home Next Page

 
 
  Published under the terms of the Creative Commons License Design by Interspire