You have been hired to create a Database for the new library in town. We initially tried to use...

18
Welcome to Access

Transcript of You have been hired to create a Database for the new library in town. We initially tried to use...

Page 1: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Welcome to Access

Page 2: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Welcome to Access Day 1

You have been hired to create a Database for the new library in town.

We initially tried to use Excel to keep track of our data, but realized that we just couldn’t keep track of our data in a spreadsheet.

Over the course of the next five days you will learn the concepts of creating a database and making it functional for every day use.

Page 3: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Excel vs Access

EXCEL

Creates spreadsheets Stores flat data Analyzes data and

performs sophisticated mathematical functions

Presents data in charts and graphs.

ACCESS

Create databases Stores LOTS of data

and relates it Retrieves data based

on criteria Enables easy data

entry Creates customizable

reports

Page 4: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

When we made it in Excel…In Excel we realized that we would have to duplicate the book record every time a the book was borrowed, or essentially create a new record for the book each time.

Page 5: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

If we made it in Access…

Access can store one record of a book in a database and tie all the instances of a book borrow to that one book.

Page 6: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

When we made it in Excel…

We tried to create a record for a patron, but we realized we couldn’t do it unless they checked out a book at the same time.

Page 7: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

If we made it in Access…

We can have a separate table for Patrons and just connect each patron to a borrow when they check out a book.

Page 8: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

When we made it in Excel…

We needed to change a patron’s phone number, but we realized we’d have to change all the instances of a patron borrowing a book. Such a headache!

Page 9: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

If we made it in Access…

We can just go to the patron’s record in the Patron table, change their phone number and every borrow will still be connected to the same record.

Page 10: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

When we made it in Excel…We wanted to delete a borrow from the spreadsheet, but we realized that in doing so we’d also delete the customer information. What if that were the only time they checked out a book? We’d loose that information completely.

Page 11: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

If we made it in Access…

Because the patrons are stored in a separate table from the borrows, we can delete a borrow without deleting the Patron.

Page 12: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Library Database Example

Access can store data in separate tables and relate them

Access can create queries that can pull out very specific pieces of data

Access can create forms that allow for quick and user friendly data entry

Access can create reports to present your data.

Page 13: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Table Design

What fields should we include in the Books and Patrons table?

Data types Each field should be the smalled

data chuncks you can think of. Example: Separate First_Name and Last

Name into two different fields.

Page 14: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

What fields would you want?

Books• Book ID (PK)• Title• Author First• Author Last• Book Year• Genre• Checked In

Patrons• Patron ID (PK)• Patron First Name• Patron Last Name• Patron Phone• Library Card

Number• Address• City, State , ZIP• Country• Patron Info

Page 15: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Define the relationships

Citizen

Bus

Car

Student

Athlete

Book

Person

Mother

Sale

Book

Get into pairs and define the relationships between the following entities:• For example how many social security numbers would one citizen

have? • One to one

• How many passengers can one bus have? • One to many or Many to many

Social Security Number

Passenger

Owner

Class

Sports Team

Genre

Bank Account

Child

Cash Collection

Book Checkout

Page 16: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

REA Diagrams

Resources—what kind of resources do we need to keep track of for the library?

Events—what kind of events will we need to track in the library?

Agents—Who will be the participants in the library?

Page 17: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Borrows• Borrow ID (PK)• Book ID (FK)• Patron ID (FK)• Employee ID

(FK)• Checked Out

Date• Due Date• Checked In Date

Books• Book ID (PK)• Title• Author First• Author Last• Book Year• Genre• Checked In Employees

• Employee ID (PK)

• Employee First Name

• Employee Last Name

• Address• Hire_Date

Patrons• Patron ID (PK)• Patron First

Name• Patron Last

Name• Patron Phone• Library Card

Number• Address• City• State • ZIP• Country• Patron Info

Resources

Events Agents

=one to many

Page 18: You have been hired to create a Database for the new library in town.  We initially tried to use Excel to keep track of our data, but realized that.

Now it’s your turn!

Let’s start creating the tables in Access and make the relationships between them!