The Visibooks Guide
to Base 2.0
by Jill & Kevin Jordan
www.visibooks.com
The Visibooks Guide to Base 2.0
Copyright
Copyright © 2006 by Visibooks™, LLC. All rights reserved.
Trademarks and Disclaimer
Visibooks™ is a trademark of Visibooks, LLC. All brand and product names in this book
are trademarks or registered trademarks of their respective companies.
Visibooks™ makes every effort to ensure that the information in this book is accurate.
However, Visibooks™ makes no warranty, expressed or implied, with respect to the
accuracy, quality, reliability, or freedom from error of this document or the products
described in it. Visibooks™ makes no representation or warranty with respect to this
book’s contents, and specifically disclaims any implied warranties or fitness for any
particular purpose. Visibooks™ disclaims all liability for any direct, indirect,
consequential, incidental, exemplary, or special damages resulting from the use of the
information in this document or from the use of any products described in it. Mention of
any product does not constitute an endorsement of that product by Visibooks™. Data
used in examples are intended to be fictional. Any resemblance to real companies,
people, or organizations is entirely coincidental.
ISBN 1597060380
Table of Contents
Database Basics ............................................. 1
Create a new database ..........................................................................2
Create tables ........................................................................................12
Create records......................................................................................21
Create forms .........................................................................................29
Create queries ......................................................................................42
Create reports ......................................................................................49
Working with Tables ..................................... 65
Modify tables ........................................................................................66
Create new tables.................................................................................76
Specify data types................................................................................79
Specify field properties .......................................................................85
Edit records ..........................................................................................88
Find records .........................................................................................91
Sort and filter records..........................................................................96
Create table relationships .................................................................101
TABLE OF CONTENTS
i
Working with Forms ....................................113
Modify forms ...................................................................................... 114
Add/delete records ............................................................................ 119
Edit records........................................................................................ 121
Find records....................................................................................... 123
Filter records...................................................................................... 126
Working with Queries ..................................131
Create queries.................................................................................... 132
Sort results......................................................................................... 141
Add criteria......................................................................................... 143
Employ Boolean operators ............................................................... 146
ii
TABLE OF CONTENTS
Database Basics
In this section, you’ll learn how to:
• Create a new database
• Create tables
• Create records
• Create forms
• Create queries
• Create reports
DATABASE BASICS
1
Create a new database
1.
Start OpenOffice.org Base.
Your screen should look like this:
2
DATABASE BASICS
2.
In the Database Wizard window, click Create a new database.
Then click the
button.
DATABASE BASICS
3
3.
When the Save as window appears, create a new folder in the
My Documents folder called Practice Base Files.
Tip: To create a new folder, make sure the My Documents
folder appears as the Save In folder.
Then click the
4.
icon.
Double-click the Practice Base Files folder.
It should appear as the Save In folder.
4
DATABASE BASICS
5.
In the File name box, type:
Family.odb
Tip: Base will automatically add a file extension for you when
you leave the Automatic file name extension box checked.
DATABASE BASICS
5
6.
Click the
button.
The window for the Family database should open:
6
DATABASE BASICS
Identify database elements
Elements of databases
A database stores information in an organized way, and makes it easy
to get information in and out.
Tables store data within the database.
Forms make it easy to put data into tables.
Queries pull out specific data.
Reports put data in an easily-read format.
Form
Query
Table
Table
Report
DATABASE BASICS
7
1.
8
In the Database list, click Tables.
DATABASE BASICS
2.
Click Queries.
DATABASE BASICS
9
3.
10
Click Forms.
DATABASE BASICS
4.
Click Reports.
5.
Click Tables.
DATABASE BASICS
11
Create tables
1.
12
Click Create Table in Design View.
DATABASE BASICS
A blank table should open with the columns Field Name, Field
Type, and Description:
DATABASE BASICS
13
Name fields in Design View
1.
Click in the box under the Field Name column header:
2.
Type:
First Name
14
DATABASE BASICS
3.
Press the ENTER key on your keyboard.
The Design View of the table should look like this:
The field type for First Name can stay Text [VARCHAR].
DATABASE BASICS
15
4.
Click in the box under where you just typed First Name.
Type:
Last Name
It should look like this:
5.
16
Press the ENTER key on your keyboard.
DATABASE BASICS
6.
In the same way, create the following fields:
City
Zip
Phone Number
The table should now look like this:
DATABASE BASICS
17
7.
On the Menu Bar, click File, then Save.
8.
When the Save As window appears, type:
My Family
in the Table Name box.
9.
18
Click the
DATABASE BASICS
button.
10.
When the alert window that reads No primary key appears, click
the
button.
Base will insert an ID field—the Key field—in the table:
DATABASE BASICS
19
11.
On the Menu Bar, click File, then Close.
The key field
When the alert window popped up, and you clicked the
Base added the ID field to the table.
button,
The ID field is now the table’s primary key, or key field. That means it
can’t contain any duplicates.
Every table should have a key field.
For example, if a hospital keeps a database, each patient can have a
unique ID number in the key field.
That way, if it has more than one patient named John Baker, it can
easily distinguish John Baker, ID #326 in for a checkup, from John
Baker, ID #298 who needs his gall bladder removed.
20
DATABASE BASICS