• Tidak ada hasil yang ditemukan

Visibooks The Visibooks Guide To Base 2 0 Apr 2006 ISBN 1597060380 pdf

N/A
N/A
Protected

Academic year: 2019

Membagikan "Visibooks The Visibooks Guide To Base 2 0 Apr 2006 ISBN 1597060380 pdf"

Copied!
162
0
0

Teks penuh

(1)
(2)

The Visibooks Guide

to Base 2.0

(3)

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.

(4)

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

(5)

TABLE OF CONTENTS ii

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

(6)

Database Basics

In this section, you’ll learn how to:

Create a new database

Create tables

(7)

DATABASE BASICS 2

Create a new database

1.

Start OpenOffice.org Base.

(8)

2.

In the Database Wizard window, click Create a new database.

(9)

DATABASE BASICS 4

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 icon.

(10)

5.

In the File name box, type: Family.odb

(11)

DATABASE BASICS 6

6.

Click the button.

(12)

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.

Table

Query

Report Form

(13)

DATABASE BASICS 8

(14)
(15)

DATABASE BASICS 10

(16)

4.

Click Reports.

(17)

DATABASE BASICS 12

Create tables

(18)
(19)

DATABASE BASICS 14

Name fields in Design View

1.

Click in the box under the Field Name column header:

2.

Type:

(20)

3.

Press the ENTER key on your keyboard.

The Design View of the table should look like this:

(21)

DATABASE BASICS 16

4.

Click in the box under where you just typed First Name.

Type:

Last Name

It should look like this:

(22)

6.

In the same way, create the following fields: City

Zip

Phone Number

(23)

DATABASE BASICS 18

7.

On the Menu Bar, click File, then Save.

8.

When the Save As window appears, type:

My Family

in the Table Name box.

(24)

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:

(25)

DATABASE BASICS 20

11.

On the Menu Bar, click File, then Close.

The key field

When the alert window popped up, and you clicked the button, Base added the ID field to the table.

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.

(26)

Create records

1.

Double-click the table My Family in the Tables list.

2.

Click in the box under the ID column header.

3.

Type:

(27)

DATABASE BASICS 22

4.

Click in the box under the First Name column header.

5.

Type:

Elvis

6.

Press the TAB key on your keyboard. The table should now look like this:

7.

Type:

Presley

then press the TAB key.

8.

Type:

Baltimore

(28)

9.

Type: 21212

then press TAB.

10.

Type:

4105551212

then press TAB.

The table should now look like this:

Tip: Notice how the cursor in the row selector has moved down to the second (new) record.

(29)

DATABASE BASICS 24

Add new fields

1.

On the Menu Bar, click File, then Close.

(30)

3.

When the menu appears, click Edit.

(31)

DATABASE BASICS 26

4.

Click the box under Phone Number and type:

State

5.

Press the ENTER key.

6.

On the Menu Bar, click File, then Save.

(32)

8.

Double-click the My Family table.

9.

Click inside the new State field for the first record.

10.

Type:

(33)

DATABASE BASICS 28

11.

Press TAB until the cursor moves down to a new record.

Record number 1 is saved and complete.

(34)

Create forms

(35)

DATABASE BASICS 30

(36)

3.

When the Form Wizard window appears, click the button.

All the table fields should be added to the form:

(37)

DATABASE BASICS 32

5.

When the next screen appears, leave Add Subform unselected

(38)
(39)

DATABASE BASICS 34

(40)

7.

When the Set the name of the form screen appears, type: My Family Data Input Form

(41)

DATABASE BASICS 36

8.

Click the button.

(42)

Add a new record

1.

In the form window, click the button.

(43)

DATABASE BASICS 38

2.

Click in the ID box, then type: 2

(44)

4.

Type: Bo

then press the TAB key.

5.

Type:

Diddley

then press the TAB key.

6.

Type:

Richmond

then press the TAB key.

7.

Type:

23220

then press the TAB key.

8.

Type:

8005557890

(45)

DATABASE BASICS 40

9.

Type:

VA

(46)

10.

Press the TAB key again.

The form should progress to a new, blank record:

The old record has been saved.

(47)

DATABASE BASICS 42

Create queries

1.

In the Database list, click Queries. What’s a query?

A query is a way to get specific information from the database.

(48)
(49)

DATABASE BASICS 44

3.

When the Query Wizard opens, double-click My Family.First Name in the Available Fields list.

(50)

4.

Click the button.

This should add the Last Name field to the Fields in the Query list:

5.

Double-click My Family.Phone Number.

(51)

DATABASE BASICS 46

This should add the Phone Number field to the Fields in the Query list:

(52)

7.

When the Overview screen appears, in the Name of the query box type:

Names and Numbers

8.

Click the button.

The query is automatically saved and executed.

(53)

DATABASE BASICS 48

(54)

Create reports

(55)

DATABASE BASICS 50

2.

Click Use Wizard to Create Report.

3.

When the Report Wizard window appears, click the Tables or Queries drop-down arrow.

(56)
(57)

DATABASE BASICS 52

5.

In the Fields in report list box, click ID, then click the button. The ID field should be removed.

The report wizard should now look like this:

(58)
(59)

DATABASE BASICS 54

(60)

9.

When the Sort options screen appears, click the Sort by drop-down arrow.

Then click State in the list.

(61)

DATABASE BASICS 56

Choose layout and style

1.

When the Choose layout screen appears, make sure Default is selected in the Layout of data section.

Then click the button.

(62)

View the report

1.

When the Create report screen appears, make sure the Title of report box reads:

My Family

(63)

DATABASE BASICS 58

2.

Click the button.

The report is automatically created, saved and opened.

It should look like this:

3.

On the Menu Bar, click File, then Close to return to the Family database window.

(64)
(65)

DATABASE BASICS 60

Practice: Database Basics

1.

Open OpenOffice.org Base.

2.

Create a blank database in the Practice Base Files folder called Library.odb.

3.

Create a new table with these fields: ID

Allow Base to create a Primary Key.

(66)

6.

Enter these data into the table to create the first record: Title: Ideas & Opinions

Author: Albert Einstein Genre: Nonfiction

Date purchased: 11/18/2005 Number of Pages: 384

It should look like this:

7.

Close the Books table.

(67)

DATABASE BASICS 62

9.

Save it as Books Table Data Input. It should look like this:

Use the form to enter information for four more books.

Tip: Feel free to make things up.

10.

Create a query that pulls out this information: Title

Genre

(68)

11.

Save the query as Quick Book Notes.

12.

Run the query.

It should look like this:

13.

Create a report based on the Books table.

14.

Include all the fields of the Books table in the report, and sort the records based on Genre.

(69)

DATABASE BASICS 64

15.

Name the report Book Inventory.

It should look like this:

16.

Close the report.

(70)

Working with Tables

In this section, you’ll learn how to:

Modify tables

Create new tables

Specify data types

Specify field properties

Edit records

Find records

Sort and filter records

(71)

WORKING WITH TABLES 66

Modify tables

1.

Open a web browser and go to:

www.visibooks.com/books/base2

2.

Right-click the FlowerStore.odb link.

(72)

3.

When the Save As window appears, open the Practice Base Files folder on your hard drive.

Then click the button.

(73)

WORKING WITH TABLES 68

Open an existing database

1.

Start Base.

(74)
(75)

WORKING WITH TABLES 70

(76)
(77)

WORKING WITH TABLES 72

Adjust table layout

(78)

2.

Place your cursor on the divider between the Phone Number and Fax Number column headings.

(79)

WORKING WITH TABLES 74

3.

Double-click.

The Phone Number column should resize to fit the widest piece of data in that field:

(80)

4.

Double-click the divider between the City and State column headings.

The City field should resize to fit the data in it.

(81)

WORKING WITH TABLES 76

Create new tables

1.

Click Create Table in Design view.

(82)

2.

In the first box in the Field Name column, type: Order ID

then press the TAB key.

It should look like this:

(83)

WORKING WITH TABLES 78

4.

When the Save As window appears, type:

Orders

in the Table Name box.

5.

Click the button.

6.

When the alert window appears, click the button.

(84)

Specify data types

Assign the AutoNumber data type

1.

In the Data Type column beside the Order ID field, click the drop-down arrow.

When the list appears, click Integer.

2.

Under Field Properties, beside the AutoValue field, click the drop-down arrow.

(85)

WORKING WITH TABLES 80

3.

In the Description column, type:

This is the Generic Order ID Number

then press TAB.

Tip: Filling in a Description is optional, but it helps you to

(86)

Assign the Date/Time data type

1.

In the Field Name column, in the second row, type: Order Date

then press TAB.

2.

In the Data Type column, click the drop-down arrow.

(87)

WORKING WITH TABLES 82

4.

In the Description column, type: Date the order was placed

(88)

Assign a Primary Key

1.

Right-click the Order ID field.

2.

When the menu appears, click Primary Key.

(89)

WORKING WITH TABLES 84

(90)

Specify field properties

1.

Click in the Order Date field.

(91)

WORKING WITH TABLES 86

3.

In the menu of formats that appears, click 12/31/99.

Then click the button.

The Order Date’s Format example field should now look like this:

(92)

4.

On the Toolbar, click the icon.

Tip: If a Warning window appears, click the button.

The table design window should now look like this:

(93)

WORKING WITH TABLES 88

Edit records

1.

Open the Customers table.

2.

Click inside the Customer Name field for record number 1, between the w and s in Andrews Floral.

3.

Insert an apostrophe.

(94)

5.

Type:

2125554569

It should replace the previous text:

6.

Click in any other record.

Tip: Remember—changed data in a record is saved when you move off that record.

(95)

WORKING WITH TABLES 90

Delete records

1.

Right-click the button for HomeVase’s record.

2.

In the menu that appears, click Delete Rows.

3.

When the alert window appears, click the button.

(96)

Find records

Navigate records

1.

In the Customers table window, click the (Last Record) button.

The cursor should be in the last record in the database:

2.

Click the (Previous Record) button.

(97)

WORKING WITH TABLES 92

3.

Click the (First Record) button. The cursor should be in the first record.

4.

Click the (Next Record) button.

The cursor should be in the second record.

5.

Click the (New Record) button.

(98)

Search for records

1.

Click the Company Name column header.

The table should look like this:

(99)

WORKING WITH TABLES 94

3.

When the Record Search window appears, type:

Love

in the Search for Text box.

(100)

5.

Click the button.

The Customers table should now look like this, with Love Me True highlighted:

(101)

WORKING WITH TABLES 96

Sort and filter records

Sort in descending order

1.

Click the Company Name column header.

The table should look like this:

(102)
(103)

WORKING WITH TABLES 98

Sort in ascending order

1.

Click the Customer ID column header to highlight the column.

2.

On the Toolbar, click the (Sort Ascending) icon.

(104)

Filter records

1.

Click in the State field for Pete’s Moss.

Notice that the State is Virginia.

2.

On the Toolbar, click the (AutoFilter) icon.

(105)

WORKING WITH TABLES 100

3.

On the Toolbar, click the (Remove Filter) icon.

The Customers table should show its original contents:

4.

On the Menu Bar, click File, then Close to return to the FlowerStore database window.

When to filter

Filtering records works like a query, bringing up specific information from a table.

But unlike a query, your filtering doesn’t remain part of the database.

When you perform a query and save it, the query remains with the database, even after you close it. Filtering does not.

(106)

Create table relationships

What are “relationships?”

Relationships are links that associate a field in one table with a field in another.

An example is a school database with two tables:

• Students • Classes

The Students table holds students’ names and addresses:

Students

Student Name Address

John Elm St. Jane Oak St.

The Math Class table holds information about the students in math class:

Math Class

Student Name Grade

John A Jane B

Both tables have a Student Name field.

By linking the Student Name fields, you make sure that John in the Students table is the same John listed in the Math Class table:

Students Math Class

Student Name Address Student Name Grade

(107)

WORKING WITH TABLES 102

Examine current table relationships

1.

On the Menu Bar, click Tools, then Relationships.

(108)

The Customers table should appear in the Relationships work area:

3.

In the Add Tables window, double-click Employees.

(109)

WORKING WITH TABLES 104

4.

Double-click Order Details.

5.

Double-click Orders.

6.

Double-click Products.

(110)
(111)

WORKING WITH TABLES 106

Add relationships

1.

Place the cursor on the Title Bar at the top of the Employees table.

(112)

3.

Click and drag the Orders table to place it between the

Customers table and Order Details table.

4.

Click the Order ID field in the Order Details table, then drag it and rest it on top of the Order ID field in the Orders table.

(113)

WORKING WITH TABLES 108

5.

Release the mouse button.

The relationships window should now look like this:

The Order ID field in the Orders table is linked to the Order ID field in the Order Details table.

The same Order ID number in both tables refers to the same order.

6.

On the Menu Bar, click File, then Close to return to the

FlowerStore database window.

7.

When the alert window appears, click the button.

(114)

Practice: Working with Tables

1.

Start Base.

2.

Open the Library database in the Practice Base Files folder.

3.

Create a new table in Design View.

4.

Add the following fields in the new table (data type in parentheses):

Author ID (Autonumber)

Author Name (Text)

(115)

WORKING WITH TABLES 110

5.

Set the Author ID field as the key field. The table design should look like this:

6.

Save the table as Authors, then close it.

7.

Open the Books table and view it in Design View.

(116)

9.

Change the data type of the Date Purchased field to Date/Time, and its format to 12/31/99.

10.

Save the Books table, then close it.

Tip: An alert window will appear saying there was an error, due to changing the Date Purchased data type. Z

Click the button.

11.

Open the Relationship design window.

12.

Add the two tables: Books and Authors.

(117)

WORKING WITH TABLES 112

When you’re done, it should look like this:

14.

Close the Relationship design window and save the changes.

(118)

Working with Forms

In this section, you’ll learn how to:

Modify forms

Add/delete records

Edit records

(119)

WORKING WITH FORMS 114

Modify forms

1.

Start Base, then open the FlowerStore database.

(120)

3.

Right-click Customer Form.

(121)

WORKING WITH FORMS 116

Tip: Clicking Edit opens the form in Writer.

(122)

Change field position

1.

Click the Address 2 box to select it.

(123)

WORKING WITH FORMS 118

3.

Click-and-drag the box to line it up with the other boxes.

Release the mouse button.

(124)

Add/delete records

Add a new record

1.

Click the icon to toggle the view.

2.

Click the (New Record) button.

Fill in the following information:

Amy Moore Gifts & Buds

1214 Maryland Ave. Suite 13

Washington, DC 20001 2025556113

2025556114

(125)

WORKING WITH FORMS 120

Delete records

1.

Click the button to go back to record number 6, the one you just added.

2.

On the Toolbar, click the (Delete Record) icon.

(126)

Edit records

Navigate to a specific record number

1.

Click in the Record box.

2.

Highlight the current record number, then type: 2

3.

Press the ENTER key.

(127)

WORKING WITH FORMS 122

Edit data in a record

1.

Delete the contents of the Street Address field.

2.

Type:

476 New York Ave.

3.

Press the TAB key.

The record should look like this:

(128)

Find records

1.

Click the button.

2.

Click in the Company Name box to place the cursor there.

(129)

WORKING WITH FORMS 124

4.

When the Record Search window appears, type:

Floral

(130)

5.

Click the button.

The window should look like this:

(131)

WORKING WITH FORMS 126

Filter records

1.

Click in the State box.

(132)

The form should now look like this:

Tip: Notice the number of records now reads 1 of 2.

3.

On the Toolbar, click the icon.

4.

On the menu bar, click File, then Close.

(133)

WORKING WITH FORMS 128

The database window should now look like this:

(134)

Practice: Working with Forms

1.

Open a web browser and go to:

www.visibooks.com/books/base2

2.

Right-click the Library2.odb link, and save the database in the Practice Base Files folder.

3.

Close the browser and start Base.

4.

Open the Library 2 database.

5.

Using the Form Wizard, create a new form based on the Authors table, using all the fields.

6.

Save the form as Author Information Input.

7.

Using the form, enter information for John Grisham: Author ID: (Autonumber)

Author Name: John Grisham Good Author? Yes

8.

Close the form.

(135)

WORKING WITH FORMS 130

(136)

Working with Queries

In this section, you’ll learn how to:

Create queries

Sort results

Add criteria

(137)

WORKING WITH QUERIES 132

Create queries

1.

Start Base, and open the FlowerStore database.

2.

In the Database list, click Queries.

(138)
(139)

WORKING WITH QUERIES 134

4.

In the Add Tables window, click Customers.

Then click the button.

(140)

This adds the Customers table to the query.

(141)

WORKING WITH QUERIES 136

Add fields to query

1.

Click the arrow in the first column’s Field box.

(142)

The query design grid should look like this:

3.

Drag the First Name field from the Customers table to the second column of the query design grid.

(143)

WORKING WITH QUERIES 138

The First Name field should appear in the design grid:

4.

Drag the Last Name field to the design grid. The design grid should look like this:

(144)

Run the query

1.

On the Toolbar, click the icon.

(145)

WORKING WITH QUERIES 140

(146)

Sort results

1.

In the Last Name field, click in the Sort row.

When the drop-down arrow appears, click it, then click Ascending.

(147)

WORKING WITH QUERIES 142

2.

On the Toolbar, click the icon.

The query should run, and sort the records alphabetically by Last Name:

3.

In the Last Name field, click in the Sort row, then click (not sorted).

(148)

Add criteria

1.

In the query’s Customer table, scroll down to the State field.

2.

Add the State field to the query design grid.

(149)

WORKING WITH QUERIES 144

4.

Type:

VA

5.

Press the ENTER key.

It should look like this:

Tip: Notice that Base automatically surrounded the VA criterion with quotes. That’s because the State field stores text data. In database query language, quotes signify a string of text.

(150)

6.

On the Toolbar, click the icon. The query results should look like this:

(151)

WORKING WITH QUERIES 146

Employ Boolean operators

What are Boolean operators?

Boolean operators are expressions such as AND, OR, NEITHER, and NOR that allow you to add multiple criteria to a query. They take their name from George Boole, the mathematician who first used them.

If you had a T-shirt store with an Base database, for instance, and you wanted to find out how many of your California customers had ordered blue T-shirts, you’d employ the AND operator in your query:

customers from California AND

who also bought blue T-shirts

If you wanted to see how many customers were from California (these California customers could have bought T-shirts of any color),

and how many customers bought blue T-shirts (these blue T-shirt customers could be from anywhere),

you’d employ the OR operator:

customers from California OR

(152)

Employ the OR operator

1.

In the State field, click in the Or row under the criterion VA.

2.

Type:

MD

then press the ENTER key.

(153)

WORKING WITH QUERIES 148

Tip: The two common Boolean operators are AND and OR. They’re easily confused. If you don’t know which to use, ask yourself the purpose of the query:

Do I want to find customers with a state of both Virginia AND Maryland?

No—a customer can’t be in two places at once.

Do I want to find customers with a state of either Florida OR Maryland?

That makes sense, so this query would use the OR operator.

3.

Click the icon.

(154)

Employ the AND operator

1.

Remove the query criteria from the State field. Tip: Highlight them, then press the DELETE key.

The design grid should be blank:

2.

Add the Company Name field to the query:

(155)

WORKING WITH QUERIES 150

3.

In the Company Name field, click in the Criterion row.

4.

Type:

LIKE A*

then press the ENTER key.

Tip: An asterisk (*) stands for any character or combination of characters. For instance, Ap* would match Ape, Aptitude, Apparent, etc.

The LIKE keyword is used to search for a pattern.

5.

Click the icon.

The query results should look like this:

The query shows all companies whose names begin with A.

(156)

7.

When the Save As window appears, type: Companies that begin with A

in the Query Name box.

8.

Click the button.

9.

On the Menu Bar, click File, then Close.

You should return to the FlowerStore database window.

(157)

WORKING WITH QUERIES 152

Practice:

Working with Queries

1.

Start Base.

2.

Open the Library 2 database.

3.

Create a new query in Design view based on the Authors table.

4.

Add all the fields to the design grid.

5.

Sort Authors Names in Ascending order.

6.

Add the criteria Yes to the Good Author field.

7.

Run the query.

Its results should look like this:

(158)
(159)
(160)

Glossary

Boolean Operators

Boolean logic is a system of logical thought developed by George Boole. Boolean operators allow you to construct complex queries which can be understood by computers. The most common Boolean operators are “AND” and “OR”.

Data

A series of facts. When data is organized, it becomes useful information, which can be processed and used to draw conclusions.

Database

A collection of information organized into tables of data.

Field

A single unit of data stored as part of a database record.

Form

A database object primarily used to enter or display data.

Key Field

A field in a table that can contain no duplicates. The key field is each record’s unique identifier.

Query

A set of questions presented to a database to retrieve specific information.

Record

One row in a given table. In a relational database, records correspond to rows in each table.

Relationship

(161)

GLOSSARY 156

Report

Presents information retrieved from a table or query in a preformatted, easy-to-read way.

Select Query

A query that asks a question about the data stored in tables, and provides a result in the form of a datasheet.

Table

A collection of rows and columns that organize data.

Update Query

(162)

Where to Get Visibooks

If you liked using this book, and would like to use more like it, visit:

www.visibooks.com

Visibooks offers more than 30 titles on subjects such as:

Computer Basics

Microsoft Office

Desktop Linux

OpenOffice.org

Web Site Layout

Web Graphics

Web Programming

Referensi

Dokumen terkait

dibutuhkan untuk kenaikan pangkat/jabatan fungsional dosen yang diusulkan. Angka kredit paling rendah 0,5 akan tetapi setiap Perguruan Tinggi dapat menentukan. syarat paling

Based on Rapid Upper Limb Assesement (RULA) method, the RULA score obtained is 5 which means that the work posture requires analysis and improvement immediately.. The RULA

Hasil penelitian penggunaan deiksis dalam percakapan pada acara talkshow Satu Jam Lebih Dekat di stasiun televisi TvOne episode Maret 2015 yaitu jenis deiksis persona,

nasehat kepada orang lain dalam satu situasi tertentu. Dukungan sosial dalam penelitian ini dikhususkan pada dukungan sosial dari pihak keluarga atau dikatakan

[r]

[r]

Satwa yang dilindungi ini lebih banyak menghabiskan waktu di atas pohon, Walaupun demikian bekantan juga mampu berenang dan juga menyelam dengan

Dari hasil analisa didapat bahwa degradasi warna tertinggi dicapai dengan menggunakan kecepatan pengaduk 200 rpm, yaitu sebesar 89% untuk pewarna sintetis Procion Blue MR