Download Appendix

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
David M. Kroenke
A
Database Concepts 1e
Appendix
Database
Processing with
Microsoft Access
© 2002 by Prentice Hall
1
Chapter Objectives
• Learn how to use Microsoft Access to:
– Create
– Create
– Create
– Create
– Create
– Create
– Create
tables
relationships
queries using the query design tool
basic forms
forms with lookup combo boxes
basic reports
parameterized reports
© 2002 by Prentice Hall
2
Creating the Database Design
• Before you begin using Microsoft
Access, you must know what to create
• This entails creating a data model and
the corresponding data schema
• The DBMS will not help you in this
process
© 2002 by Prentice Hall
3
Create the E-R Diagram
(no help from
the DBMS)
SUPPLIER
ITEM
ORDER
SuppID
ItemNumber
OrdNumber
Address
Phone
| 1:N 0 Description
Category
© 2002 by Prentice Hall
| N:M 0 Date
Comment
4
Database Schema
• A database schema is a design of
database tables, relationships, and
constraints
• Schemas are developed by analyzing
user requirements such as forms,
queries, and reports, and then
constructing a data model
© 2002 by Prentice Hall
5
Create the Schema Design
(no help
from the DBMS)
SUPPLIER
ITEM
SuppID
ItemNumber
| 1:N 0 Description
Date
SuppID (FK)
Comment
|
Category
|
ORD_ITEM
1:N
0
Phone
OrdNumber
ItemNumber
0
Address
ORDER
N:1
OrdNumber
Quantity
© 2002 by Prentice Hall
6
Create the Data Dictionary
(no help
from the DBMS): ITEM TABLE
ITEM
ItemNumber
Autonumber
Not Null
Description
Text(30)
SuppID
Long Integer Foreign Key
refers to
SUPPLIER
Category
Text(5)
© 2002 by Prentice Hall
7
Create the Data Dictionary
(no help
from the DBMS): ORDER TABLE
ORDER
OrdNumber
Autonumber
Date
Date/Time
Comment
Memo
© 2002 by Prentice Hall
Not Null
8
Create the Data Dictionary
(no help
from the DBMS): SUPPLIER TABLE
SUPPLIER
SuppID
Autonumber
Address
Text(30)
Phone
Text(12)
© 2002 by Prentice Hall
Not Null
9
Create the Data Dictionary
(no help
from the DBMS): ORD_ITEM TABLE
ORD_ITEM
ItemNumber
Long Integer Not Null,
Foreign Key
refers to
ITEM
OrdNumber
Long Integer Not Null,
Foreign Key
refers to
ORDER
Quantity
Long Integer
© 2002 by Prentice Hall
10
Enter the DBMS
• Now that the tables and relationships
have been conceptually defined, the
DBMS may be used to actually create
the database objects.
© 2002 by Prentice Hall
11
Creating a Table with
Microsoft Access
Double-Click the “Create table in Design view” Option
© 2002 by Prentice Hall
12
Entering Field Characteristics
• Enter the Field Name, Data Type, and
Description (optional) for each field
• Click and Drag to include all Fields that
are part of the Primary Key
• With all fields making up the Primary
Key highlighted, click the Primary Key
Button
© 2002 by Prentice Hall
13
Table Define View Microsoft Access
Primary Key Button
© 2002 by Prentice Hall
14
Close the Table Design View and
Save
• To save the table, simply close the
design view window and type a name
for the table.
© 2002 by Prentice Hall
15
Microsoft Access Saving the Table
© 2002 by Prentice Hall
16
Creating the Remaining Tables
• Following the above procedure for the
remaining tables
© 2002 by Prentice Hall
17
Defining a Composite Primary Key
All fields defining the
Primary Key are highlighted
Before clicking the Primary Key
Button
© 2002 by Prentice Hall
18
Informing the DBMS of the Foreign
Key Constraints
• The DBMS must be informed regarding
what Primary Key is mapped to what
Foreign Key.
• This defines the database’s Referential
Integrity
© 2002 by Prentice Hall
19
Microsoft Access: Relationships View
• Within Microsoft Access the referential
integrity constraints are defined in the
Relationship View Window by:
– clicking on the Primary Key
– dragging to the Foreign Key
– and dropping on the Foreign Key
© 2002 by Prentice Hall
20
Relationships View
Click to enter the
Relationships View
© 2002 by Prentice Hall
21
Select the Tables to be Included
Add each table to the
Relationships View Window
by highlighting and clicking the
Add button
© 2002 by Prentice Hall
22
Arrange Tables in Relationships View
Click and Drag to arrange the tables
to avoid crossing relationship lines.
© 2002 by Prentice Hall
23
Creating a Relationship
Table Names
Field Names
Enforce
Referential
Integrity = Checked
Define Cascading
Rules
© 2002 by Prentice Hall
24
The Resulting Relationship
© 2002 by Prentice Hall
25
Create the Remaining Relationships
• Drag the Primary Key Field and Drop on
the Foreign Key field and enforce
referential integrity for each remaining
relationship
© 2002 by Prentice Hall
26
The Final Relationships View Window
© 2002 by Prentice Hall
27
Creating Queries
Click the
Queries Tab
© 2002 by Prentice Hall
28
Creating a Query in the Design View
Double-Click
“Create query in Design view”
© 2002 by Prentice Hall
29
Defining the Query
Click to
Show results
Drag & Drop Fields
to Display
Sorting and Specifying Search Criteria
© 2002 by Prentice Hall
30
Changing the View to see the SQL
Statement
Dropdown Button
Click SQL View
© 2002 by Prentice Hall
31
The SQL View of the Query
© 2002 by Prentice Hall
32
Action Queries
Dropdown Button
Choose Action type
© 2002 by Prentice Hall
33
Forms
A form a graphical display for adding,
updating, viewing, and deleting data
from one or more tables
© 2002 by Prentice Hall
34
Creating a Form
Click to Create
a Form
© 2002 by Prentice Hall
35
Create Form using the Form Wizard
Double-Click to
Launch the
Form Wizard
© 2002 by Prentice Hall
36
Choosing the Table/Query and Fields
to Include
Select the Table
or Query
Select the Field(s)
to include on the Form
© 2002 by Prentice Hall
37
Select the Form Style and Colors
A finished form
© 2002 by Prentice Hall
38
Creating a Report
Click to Create
a Report
© 2002 by Prentice Hall
39
Create a Report using the Report
Wizard
Click to Create a Report
using the Report Wizard
© 2002 by Prentice Hall
40
Choosing the Table/Query and Fields
to Include
Select the Table or Query
that provides information
for the Report
Select the Fields to
Include in the Report
© 2002 by Prentice Hall
41
Select the Report Style and Colors
A finished Report
© 2002 by Prentice Hall
42
David M. Kroenke
A
Database Concepts 1e
Appendix
Database
Processing with
Microsoft Access
© 2002 by Prentice Hall
43