You are on page 1of 57

Access Database

Training
for PhilCAFE Partners
Name

l l o ! Organization
He
Role/Position
Expectation
House Rules

 Be on time.
 Use phones only when necessary.
 Actively participate.
 Only use apps in your laptop that are relevant
for the training.
 Don’t leave training venue until the session for
the day is done.
 Observe proper COVID-19 health protocols.
Day
Rationale
Rationale
Requested capacity building on database creation
and administration.

MS Access is an easy-to-use desktop application for


creation of relational databases.

Partners who has their own database can properly


manage and utilize their own data for analysis and
decision making.
Objectives
Objectives
Introduce the use of MS Access database to partner
producer organizations and SUCs

Introduce MS Access as a database tool that


partners can maintain independently

Train partners on how to create, build, and


maintain an Access database including
customizing reports and analysis
Objectives

By the end of the activity, partners and POs will


have their own initial database that they can
further improve and utilize.
Database
Basics
Database Database terms to know…
Basics
Farmers
Farms

Relational database Sales


A database in which data is divided into tables,
Harvest
which are kind of like spreadsheets. Each table has
just one subject, such as farms (one table) or
farmers (another table). The different tables have
Products
some kind of relationship between them that
allows the user to connect these tables and
generate information.
Database Database terms to know…
Basics

Tables

Lists of rows and


columns of data
similar to a
spreadsheet
Database Database terms to know…
Basics

Record

A row in a table

Field

A column in a table
Database Database terms to know…
Basics

Queries

- A request for data results from a database


- A request to perform an action on the data
- Or both

- E.g. We will use queries if we want to get the total


coffee harvest from a specific municipality
Database Database terms to know…
Basics

Forms

- A user-friendly way to input, view, and edit data


in a structured manner.
- Can be designed to look like a paper form
Database Database terms to know…
Basics

Reports

- A way to view, format, and summarize


information from the database.
- E.g. summary report of harvests, list of
cooperative members and their contact numbers
Database Principles in the database
Basics design process

Correctness and
Duplicate information completeness of
is bad information is
important

Database with incorrect


Wastes space and increase
information → Reports with
likelihood of errors and
incorrect information →
inconsistencies
Misinformed decisions
Database Good database design
Basics

A good database design is one that:


• Divides information into subject-based tables to reduce
redundant data.
• Provide Access with the information it requires to join the
information in the tables together as needed.
• Helps support and ensure the accuracy and integrity of your
information.
• Accommodates your data processing and reporting needs.
The design process
Database
Basics

Determine the purpose of your


database
Database The design process
Basics
Determine the “What is its purpose?”
purpose of your
database “How will you use it?”
“Who will use it?”

“The customer database keeps a list of customer information for


the purpose of producing mailings and reports.”

“The database keeps tables of customer, sales, and production


information. Production staff will enter production data on a daily
basis while the sales staff will enter sales and customer data in
real time.”
Database
Basics

Find and organize the information


required
Database The design process
Basics
Find and organize
the information 1. Existing information
required
• Example: purchase order records in ledger, customer profile
filed in cabinet
• What are the questions/information in your existing forms?
• List each question/item in its smallest piece of information e.g.
instead of one question for full name, have two separate
questions one for last name and another one for first name
• If there are no existing forms, think about what
questions/fields would you include in forms that you will
design for your organization
Database The design process
Basics
Member name
Find and organize
the information
required
Member
name:_______________________
Address:
__________________________
Age:
_______________________________
Products: Address
Age 1.
___________________________
2.
___________________________
3.
___________________________

Products
Database The design process
Basics Middle name
Last name
First name
Find and organize
the information
required
Member
name:_______________________
Address:
__________________________
Age:
_______________________________
Products: Province
Birthdate 1.
___________________________ Municipality
2.
___________________________
Barangay
3.
___________________________
Street address

Product
name
Database The design process
Basics
Date
Find and organize
the information Date:_________
required __
Product Customer Qty Unit Price Total
name

Product name

Total sales

Customer
Unit price
Quantity
Database The design process
Basics
Find and organize
the information
required

2. Report/mailings you want to produce from the database


• Example: sales report by barangay, letter to coop members
• What information would you place in the report/letter? If
some of these information are not yet included in your existing
forms, add them in your list of questions/fields
Database The design process
Basics
06 June 2023
Find and organize
the information Information in Mail not yet
required available in forms
Dear Mr. Santos,

Last name As a member of Farmer Coop for • Salutation (Mr)


First name _5_ years, we are happy to inform • Years of membership
Province you that you will receive an
Municipality Product incentive by the end of the year.
Barangay name
Street address Customer
Birthdate Date of sale Farmer Coop
Product name Quantity
Unit Price
Total Cost
Database The design process
Basics
06 June 2023
Find and organize
the information Product
name
Total
Produced
Total
Sold
Inventory Total
Sales
Information in Report not
required yet available in forms

Last name • Number produced


First name • Inventory
Province
Municipality Product
Barangay name
Street address Customer
Birthdate Date of sale
Product name Quantity
Unit Price
Total Cost
Database The design process
Basics
Find and organize
the information
required
Remember:

You should break each piece of


information into its smallest useful
parts
Database
Basics

Divide information item into


tables
Database The design process
Basics
Divide the
information into
tables

• Choose major entities or subjects from the list of


information/questions generated in the previous step
• Major entities/subjects = Tables
Database The design process
Basics
Divide the
information into
tables • Last name
• Product name
• First name
• Customer
• Province
• Date of sale
• Municipality
• Quantity
• Barangay
• Unit Price
• Street address
• Total Cost
• Birthdate
• Product name

• Number produced
• Salutation (Mr) • Inventory
• Years of membership
Database The design process
Basics
MEMBERS PRODUCTS
Divide the CUSTOMERS
• Last name • Product name
• Customer name
information into • First name • Unit Price
tables • Province, Municipality,
Barangay, Street address
• Birthdate SALES
• Product name
• Product name
• Customer
• Salutation (Mr)
• Date of sale
• Years of membership/Date of
• Quantity
membership
• Unit Price
• Total Cost
GEOGRAPHY
• Province INVENTORY
• Municipality • Product name
• Barangay • Number produced
• Inventory (units in stock)
Database The design process
Basics
Divide the • Do not place all information into a single table
information into
tables • If you tend to repeat information in more than one place, try to
place this repeating information as a separate table and just link
that table to your existing one.

Product name Customer Customer Address Quantity Total Sales


Seedling – arabica Mr. Dela Cruz, Juan Maramag, Bukidnon
Seedling – robusta XYZ Farmers Association Valencia, Bukidnon
GCB – arabica ABC Coffee Co. Davao City
GCB - robusta ABC Coffee Co. Davao CIty
Database The design process
Basics
Divide the Recording customer information only once in a Customers Table:
information into
tables
• saves disk space
• Modifying customer information will be done once in customer
table, avoiding errors
Customer Customer Address
Mr. Dela Cruz, Juan Maramag, Bukidnon
XYZ Farmers Association Valencia, Bukidnon
ABC Coffee Co. Davao City
Product name Customer Quantity Total Sales
Seedling – arabica Mr. Dela Cruz, Juan
Seedling – robusta XYZ Farmers Association
GCB – arabica ABC Coffee Co.
GCB - robusta ABC Coffee Co.
Database
Basics

Turn information items into


columns
Database The design process
Basics
Turn information
items into • To determine the columns in a table, decide what information
columns you need to track about the subject recorded in the table.
• Don’t include the calculated data as columns
This will consume space. You can have Access perform the
calculation when you want to see the result e.g. in a sales report
• Store information in its smallest logical parts
Full names should be separated as last name, first name,
middle name (optional)
Addresses should be separated as province, municipality,
barangay, street address
Database
Basics

Specify primary keys


Database The design process
Basics
Specify primary
Primary Key
keys • a column or set of columns that uniquely identifies each row
stored in a table;
• often a unique identification number i.e. employee ID or serial
number;
• will always have a value
• value will never change

Access uses primary key fields to quickly associate data from


multiple tables and bring the data together.
Can use AutoNumber data type as primary key in Access.
Database The design process
Basics
MEMBERS PRODUCTS
CUSTOMERS
• MemberID • ProductID
Specify primary • CustomerID
• Last name • Product name
keys • First name
• Customer name
• Unit Price
• Province, Municipality,
SALES
Barangay, Street address
• SalesID
• Birthdate
• Product name
• Product name
• Customer
• Salutation (Mr)
• Date of sale
• Years of membership/Date of
• Quantity
membership
• Unit Price
• Total Cost
GEOGRAPHY
• Province INVENTORY
• Municipality • Product name
• Barangay • Number produced
• Inventory (units in stock)
Database
Basics

Set up the table relationships


Database The design process
Basics
Set up the table
relationships
Access is a relational database management system. It divides
information into separate, subject-based tables and then use
table relationships to bring the information together as needed.

Types of relationships
• One-to-one
• One-to-many
• Many-to-many
Database The design process
Basics
One-to-one (1:1)
Set up the table • Each record in the first table can have only one matching record in the second table, and
relationships each record in the second table can have only one matching record in the first table.
• You might use this relationship to divide a table with many fields, to isolate part of a table
for security reasons, or to store information that applies only to a subset of the main table.
• Rarely appears in a database; usually a supplemental information in a table; can eventually
change to one-to-many over time
• Example: Farms and Farm Owners Table
each farm corresponds to one record in farm owners table

Farm Farm Name Location Size FarmOwner Owner Farm ID


ID (has) ID Name
1 ABC Farm Valencia, Bukidnon 4 1 Juan 3
2 XYZ Farm Malaybalay, Bukidnon 3 2 Andres 1
3 123 Farm Impasug-ong, Bukidnon 5 3 Gregoria 2
Database The design process
Basics
Set up the table One-to-many (1:M or 1:*)
relationships
• Information in the “one” side can be repeated multiple times in the
“many” side of the relationship.
• Take the primary key on the “one” side of the relationship and add it
as an additional column or columns to the table on the “many” side of
the relationship.

CustomerID Customer Customer Address Product name Customer Quantity Total


Sales
1 Mr. Dela Cruz, Juan Maramag, Bukidnon
Seedling – arabica 1
2 XYZ Farmers Association Valencia, Bukidnon
Seedling – robusta 2
3 ABC Coffee Co. Davao City
GCB – arabica 3
GCB - robusta 3
Database The design process
Basics
Set up the table Many-to-many (M:N or *:*)
relationships
• Information can be repeated multiple times in both sides of the
relationship
• E.g. Products and Orders Table
one order can contain many products and one product can
appear in many orders

Product ID Product Name Order Number Orders


1 Seedling Arabica 2023-0001 Seedling Arabica, Seedling Robusta
2 Roasted Robusta 2023-0002 Roasted Robusta, Seedling Arabica
3 Seedling Robusta 2023-0003 Seedling Arabica, Roasted Robusta
Database The design process
Basics
Set up the table Many-to-many (M:N or *:*)
relationships
• Solution: Create a third table (called junction table) that will be the
“middle man” that creates a one-to-many relationship to Products
Table and another one-to-many relationship to Orders Table

Product ID Product Name Order Orders


ORDER DETAILS Number
1 Seedling Arabica
2 Roasted Robusta Order Number Product ID Qty 2023-0001 Seedling Arabica, Seedling
Robusta
3 Seedling Robusta 2023-0001 1 100
2023-0002 Roasted Robusta, Seedling
2023-0001 3 150 Arabica
2023-0002 2 220 2023-0003 Seedling Arabica, Roasted
Robusta
2023-0002 1 500
2023-0003 1 750
2023-0003 2 650
Database
Basics

Refine your design


Database The design process
Basics
Refine your
design Create and populate your tables with sample data and try...
• Creating queries
• Adding new records
• Create rough draft of forms
• Create rough draft of reports

Take note if there are things that needs to be added or omitted to avoid
duplication
Database
Basics

Apply normalization rules


Database The design process
Basics
Apply
normalization
rules
Normalization – a method of organizing and structuring data in
databases that minimizes redundancy and maintain data integrity

Three most commonly used normal forms:


1. First Normal Form (1NF)
2. Second Normal Form (2NF)
3. Third Normal Form (3NF)
Database The design process
Basics
Apply
normalization
First Normal Form (1NF)
rules - every row and column intersection in the table must contain a
single value, never a list of values

-e.g. you can’t have a field coffee products where you can place
more than one type of coffee product.
Coffee Farmer Date Quarter Volume (kg) Coffee Product Farmer Date Quarter Volume
Product Name Name (kg)

Arabica GCB Juan Feb 15, 2023 Q1 500 Arabica GCB Juan Feb 15, 2023 Q1 500

Robusta GCB Gabriela Apr 17, 2023 Q2 356 Robusta GCB Gabriela Apr 17, 2023 Q2 356
Arabica GCB Andres June 19, 2023 Q3 532
Arabica GCB, Andres June 19, 2023 Q3 532, 612
Robusta GCB Robusta GCB Andres June 19, 2023 Q3 612
Database The design process
Basics
Apply
normalization
Second Normal Form (2NF)
rules - must satisfy 1NF
- each non-key column is fully dependent on the entire primary
key, not on just part of the key (if composite key)
- Each table must contain about only one type of thing
Coffee Product Farmer Date Quarter Volume
Name (kg) - e.g. the table on the left violates 2NF
Arabica GCB Juan Feb 15, 2023 Q1 500 because the date and volume columns are
Robusta GCB Gabriela Apr 17, 2023 Q2 356
dependent on a combination of the Coffee
Product and Farmer Name.
Arabica GCB Andres June 19, 2023 Q3 532
Robusta GCB Andres June 19, 2023 Q3 612
Database The design process
Basics
Apply
normalization
Second Normal Form (2NF)
rules - solution: create 2 tables that contains coffee products and farmer details, link
these together in a 3rd table we will call “consolidation details” with coffee product ID
and farmer ID forming the composite primary key

coffeeProductID Coffee Product


(PK) coffeeProductID farmerID (PK) Date Quarter Volume (kg)
(PK)
CP1 Arabica GCB
CP1 F1 Feb 15, 2023 Q1 500
CP2 Robusta GCB
CP2 F2 Apr 17, 2023 Q2 356
farmerID Farmer Name
(PK) CP1 F3 June 19, 2023 Q3 532
CP2 F3 June 19, 2023 Q3 612
F1 Juan
F2 Gabriela
F3 Andres
Database The design process
Basics
Apply
normalization
Third Normal Form (3NF)
rules - must satisfy 2NF
- every non-key column is independent of each other i.e. no
other non-key column needs to be changed in a table if you
changed a non-key column
table.
coffeeProductID farmerID Date Quarter Volume
(PK) (PK) (kg) e.g. in the consolidation table on the left, 3NF
is violated because we need to change
CP1 F1 Feb 15, 2023 Q1 500 Quarter column if we change the Date column
CP2 F2 Apr 17, 2023 Q2 356
CP1 F3 June 19, 2023 Q3 532
CP2 F3 June 19, 2023 Q3 612
Database The design process
Basics
Apply
normalization
Third Normal Form (3NF)
rules Solution: create another table that will hold
the date and quarter data
coffeeProductID farmerID Date Volume
coffeeProductID Coffee Product (PK) (PK) (kg)
(PK)
CP1 F1 Feb 15, 2023 500
CP1 Arabica GCB
CP2 F2 Apr 17, 2023 356
CP2 Robusta GCB
CP1 F3 June 19, 2023 532
CP2 F3 June 19, 2023 612
farmerID Farmer Name
(PK)
Date Quarter
F1 Juan Feb 15, 2023 Q1
F2 Gabriela Apr 17, 2023 Q2
F3 Andres June 19, 2023 Q3
Let’s
take a
break!

You might also like