44
ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Embed Size (px)

Citation preview

Page 1: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

ACIS 1504 - Introduction to Data Analytics & Business Intelligence

Ad-hoc Reporting

Query Basics

Page 2: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Concept Map

Queries

Access

Tables

Sorting

Selection Criteria

Calculations

Properties

Page 3: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Objective

• State the purpose of common table properties.

• Create queries to support common business problems utilizing sorting and selection criteria.

Page 4: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Textbook Chapter VideosThe query chapters are available in video format as well:

http://www.lacoste.pamplin.vt.edu/web1504/resources/video/db.html

Page 5: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Segment A:Import

Page 6: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

What are Access Objects?

• Tables

• Queries

• Reports

• Forms

Page 7: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open XLS in Access – Step 1

Open blank desktop database & name it

Page 8: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open XLS in Access – Step 2

Load data into new table

Page 9: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open XLS in Access – Step 3

Page 10: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open XLS in Access – Step 4

Format Text Fields

Page 11: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open XLS in Access – Step 5

Add Primary Key

Page 12: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open XLS in Access – Step 6

Name Table

Page 13: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Segment B:Tables

Page 14: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Example Data

Participant Registration Card

Participant ID: 1

Age:

Gender: Male Female

Are you married? Y or NAre you a parent? Y or NAre you a home owner? Y or N

What is your favorite food?

Page 15: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Example Data

Observation Card

Participant ID #:

Observation Date:

1 = Poor … 5 = Excellent

Rating of Product A: 1 2 3 4 5Rating of Product B: 1 2 3 4 5 Rating of Product C: 1 2 3 4 5 Rating of Product D: 1 2 3 4 5

Page 16: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Open Existing Database

Start Access

Page 17: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Review Tables

Page 18: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Table Properties• Field Name

• Data Type

• Field Size

• Format (output)

• Decimal Places

• Input Mask

• Default Value

• Validation Rule

• Required

• Indexed

Page 19: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Review Relationships

Page 20: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

A database has been created to house data about your personal library of books. Open the file named Book Database.accdb and familiarize yourself with the tables and data.

Book Database

Page 21: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Segment C:Query

Page 22: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

What is the Purpose of Queries?

• Ad-hoc information retrieval

• Output subsets of data

Page 23: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Start a Query

Example: List demographics of all participants.

Page 24: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Fields

Page 25: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Run a Query

Page 26: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Show & Hide FieldsExample: List demographics of all participants but hide

homeowner field.

Page 27: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Save a Query

Page 28: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Segment D:Sort

Page 29: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Sort RecordsExample: List ratings for Product A from high to low.

Page 30: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Query More Than One Table

Example: List all observation ratings and gender of participants.

Page 31: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Primary & Secondary SortExample: List ratings by gender.

Within gender, sort by ID then Date.

Page 32: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Segment E:Selection Criteria

Page 33: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Select RecordsExample: List demographics of Female participants.

Page 34: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: Operators

Example: List demographics of all participants over 30 years of age.

Page 35: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: * and ?

Example: List demographics of all participants who like liver. Liver may be anywhere in the Favorite Food string; beginning, middle or end.

Page 36: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: NOT

Example: List demographics of all participants who did not identify ice cream as their favorite food.

Page 37: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: NULL

Example: List demographics of all participants who did not identify a favorite food.

Page 38: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: Dates

Example: List all observations recorded on Feb 24, 2011.

Page 39: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Island Books

Write a query to find the string ‘island’ anywhere in the book title. Sort your results alphabetically by title.

Extensions:• How would your solution change if you

wanted only those titles ending with the string ‘island’?• Beginning with the string ‘island’?

Page 40: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Segment F:AND vs. OR

Page 41: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: AND

Example: List demographics of female participants who are over thirty.

Page 42: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Selection Criteria: OR

Example: List demographics of participants who are either Female or over 30.

Page 43: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Combine Selection Criteria

Example: List all female participants who are married and all male participants who are parents.

Page 44: ACIS 1504 - Introduction to Data Analytics & Business Intelligence Ad-hoc Reporting Query Basics

Expensive Novels

Write a query to display all novels that cost more than $10. Display the list in alphabetical order by author. If the author has more than one book, display books from most expensive to least expensive.

Extension: How would your solution change if you wanted only novels costing exactly $10, $20 or $30?