You are on page 1of 31

David M.

Kroenkes

Database Processing:
Fundamentals, Design, and Implementation

Appendix A: Introduction to Microsoft Access Part One


DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-1

Example Database Design


Three tables: STUDENT, CLASS and GRADE

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-2

MS Access Basic Data Types


Text Memo Number
Byte Integer Long Integer Single Double Decimal

Date/Time Currency Yes/No AutoNumber


A-3

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

MS Access Table Keys


Each table has a key A key is one or more columns that identify a row:
StudentNumber in STUDENT ClassNumber in CLASS

Keys composed of more than one column are called composite keys:
(StudentNumber, ClassNumber) in GRADE

See Chapter Three for a complete discussion of keys. In this Appendix, the following keys are relevant:
Primary key The key used to identify rows in a table Foreign key The key used to link to another table Surrogate key A short, numeric key added to the table as an ideal identifier when other fields dont work as well
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-4

Example Database Design

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-5

MS Access - Relationships
StudentNumber in GRADE creates a relationship to StudentNumber in STUDENT ClassNumber in GRADE creates a relationship to ClassNumber in CLASS StudentNumber in GRADE and ClassNumber in GRADE are examples of foreign keys
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-6

Creating a Database

Use Create a new file to create a database

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-7

Creating a Table

Use Create table in Design View to create a table

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-8

Creating Columns (Fields)

(1) Type in Field Name (2) Select Data Type (3) Add a Description (4) Modify Data Type properties on General Page

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-9

The STUDENT Table Definition

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-10

The CLASS and GRADE Tables

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-11

Adding Data to Tables


We can add data to a table by:
Using the datasheet view, or Using a form

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-12

Adding Data to Tables: Using the Datasheet View

Type data into each cell. This is just like using a spreadsheet.
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-13

David M. Kroenkes Database Processing


Fundamentals, Design, and Implementation (10th Edition)

End of Presentation: Appendix A Part One

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-14

David M. Kroenkes

Database Processing:
Fundamentals, Design, and Implementation

Appendix A: Introduction to Microsoft Access Part Two


DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-15

Adding Data to Tables: Using a Form

Use Create form by using wizard to create a form

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-16

Adding Data to Tables: Using a Form

Select fields from Available Fields by using the Select Field [>] and Select All Fields [>>] buttons
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-17

Adding Data to Tables: Using a Form

Type data into each field on the form

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-18

Creating Queries

Use Create query in Design view to create a query

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-19

Creating Queries
Add tables to the query

Select fields from table fields by drag and drop the * symbol means all fields

Add criteria to determine which rows are selected by the query

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-20

Creating Queries
To run the query, use the menu command Query | Run or the button

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-21

Viewing MS Access SQL


To see the SQL version of the query, use the menu command View | SQL or the SQL button on the View drop-down list:

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-22

David M. Kroenkes Database Processing


Fundamentals, Design, and Implementation (10th Edition)

End of Presentation: Appendix A Part Two

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-23

David M. Kroenkes

Database Processing:
Fundamentals, Design, and Implementation

Appendix A: Introduction to Microsoft Access Part Three


DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-24

Creating Relationships
To create relationships between tables, use the menu command Tools | Relationships. When the Show Table dialog box appears, select the tables STUDENT, CLASS and GRADE. MS Access places the tables in the Relationships Drag StudentNumber from window. STUDENT to StudentNumber in GRADE.
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

Check Enforce Referential Integrity.


A-25

Creating Relationships: The Competed Relationships

The symbols 1 and indicate a One-to-Many [1:N] relationship


DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-26

Creating Multitable Forms


(1) As before, use Create form using wizard: Choose CLASS as the first Table/Query and add all available fields (2) Select the GRADE Table (3) Add only the fields StudentNumber and Grade using the [>] button
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-27

Creating Multitable Forms: The Final Form

Fields from CLASS

Fields from GRADE

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-28

Creating a Report
(1) Click Reports in the Objects list.

(2) Use Create report by using wizard. (3) Select: CLASS: All fields GRADE: StudentNumber, Grade STUDENT: StudentName
DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall A-29

Creating a Report: The Finished Report


(4) Click the wizards Finish button, and the finished report appears:

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-30

David M. Kroenkes Database Processing


Fundamentals, Design, and Implementation (10th Edition)

End of Presentation: Appendix A Part Three

DAVID M. KROENKES DATABASE PROCESSING, 10th Edition 2006 Pearson Prentice Hall

A-31

You might also like