Setting the Table

Yes, you could even have a table with recipes. Although that sounds like a tasty idea, I started out by saying my database was going to be a mailing list, so we will build an appropriate table.

The easiest way to get started is by using the Table Wizard. To do this, click the Table icon in the left sidebar. Now look at the top in the Tasks section. You see two entries there. The first, Create Table in Design View, is the more advanced approach, when you know what your data looks like. The second option is Use Wizard to Create Table. When you click this item, Base's Table Wizard starts (see Figure 16-5).

Figure 16-5. The Table Wizard comes with a number of predefined tables for business and personal use.


When selecting the Table Wizard (or any of the Base wizards), you may get a message telling you that you need to turn on the Java runtime. First, you need to make sure you have a Java runtime installed. Luckily, automatically discovers its location. Click Tools on the menu bar, and then select Options. On the Options window, click Java from the sidebar, and then check the box Use a Java Runtime Environment.

The Table Wizard comes with a number of predefined tables for common tasks. All of these table definitions are divided into two categories, Business and Personal. Click the radio button for one or the other, then click the Sample Tables drop-down box to browse the table types. Under Business, you find things like Assets, Customers, Employees, Expenses, Projects, Suppliers, and many more. The Personal list has items such as Accounts, CD-Collection, Diet Log, and Household Inventory, to name just a few. For now, click the Personal radio button and select Addresses from the table list. A list of fields appears below the radio button (see Figure 16-6).

Figure 16-6. Most sample tables have many more fields defined than you may actually want.

If you scroll down that list of available fields, you see a lot more information than you actually need. You can click the double arrow in the middle (the right pointing one) and all the fields are selected. You can also select them one by one, as I have done in Figure 16-6. In the case of a simple mailing list, you may not need anything more than name, address, city, state, phone number, and email address. After you have finished selecting these fields, you can choose to click Finish or click Next to edit the format of each individual field. Let's pretend that the definition and format of these fields are okay. Click Next to move to the primary key selection screen (see Figure 16-7).

Figure 16-7. Each record in a database requires a unique, primary key. You can choose to base that key on your selected fields or let Base create one for you.

The primary key selection screen is important because a key is how you access and store information in a table. Although you can search on any field, a key needs to be a unique piece of information under which the record is stored. A classic example is the Social Security Number (or Social Insurance Number), which is unique to the individual. You can let Base generate a primary key for you, and that is the default. By checking the Auto Value box, Base automatically generates a key with each record you create.

Your other options are to use an existing field (like that SSN/SIN) or to define a combination of your fields to create that uniqueness.

Let's go with the default for now. Check the Auto Value box as well. Click Next and the final part of the wizard, the Create Table page, appears (see Figure 16-8). If you are using the wizard, Base suggests a name for the table, but you can call it anything you like. I'm going to accept the default of Addresses because that suits me just fine. Keep in mind that although our database is called Mailing List, there can be a lot more associated with a mailing listthe Addresses table is just a small part of it.

Figure 16-8. The last step of the Table Wizard names your table and gives you the option to start entering data immediately.

We are done with the wizard, but before you click Finish, you have one last choice to make, and three options to choose from. The first is to start adding data (I'll show you that in a moment). The second is to go back and make other changes to the table design. The final choice is to create a form based on this table. I'll show you what happens in both cases, but let's start with the default option, Insert Data Immediately. When you do that, a spreadsheet-like window appears with rows of data and columns representing the fields in your table (see Figure 16-9).

Figure 16-9. Inserting data is as easy as working with a spreadsheet.

There is one other item I'd like you to look at in the Base Tables view. It's not a big deal, but it's kind of cool, so I'm going to tell you about it.

In the lower part of the main screen (the Tables section), click the Addresses table (at this time, there is only one). Now, look to the right and you see a drop-down list with None selected. Click the button and select Document. You get a pretty cool little preview of your table and the data in it (see Figure 16-10).

Figure 16-10. The lower part of the left pane lists your tables and provides a small preview of the data when you click a table.

No Wizards for Me!

Before we move on to the next step, I want to touch on the subject of creating a table in design view. There's no question that using the wizard is by far the easiest way to do this, but using the design view isn't much more difficult. It does have the advantage of giving you greater control over the format of your tables, but you have to think about what fields you want, and what you want those fields to look like (see Figure 16-11). In that respect, I recommend it only if you already have some experience in database and table design.

Figure 16-11. Creating tables using design view requires some knowledge of database and table design.

Moving to Ubuntu Linux
Moving to Ubuntu Linux
ISBN: 032142722X
EAN: 2147483647
Year: 2004
Pages: 201

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: