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

Post on 17-Jan-2016

218 views 0 download

transcript

ACIS 1504 - Introduction to Data Analytics & Business Intelligence

Ad-hoc Reporting

Query Basics

Concept Map

Queries

Access

Tables

Sorting

Selection Criteria

Calculations

Properties

Objective

• State the purpose of common table properties.

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

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

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

Segment A:Import

What are Access Objects?

• Tables

• Queries

• Reports

• Forms

Open XLS in Access – Step 1

Open blank desktop database & name it

Open XLS in Access – Step 2

Load data into new table

Open XLS in Access – Step 3

Open XLS in Access – Step 4

Format Text Fields

Open XLS in Access – Step 5

Add Primary Key

Open XLS in Access – Step 6

Name Table

Segment B:Tables

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?

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

Open Existing Database

Start Access

Review Tables

Table Properties• Field Name

• Data Type

• Field Size

• Format (output)

• Decimal Places

• Input Mask

• Default Value

• Validation Rule

• Required

• Indexed

Review Relationships

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

Segment C:Query

What is the Purpose of Queries?

• Ad-hoc information retrieval

• Output subsets of data

Start a Query

Example: List demographics of all participants.

Fields

Run a Query

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

homeowner field.

Save a Query

Segment D:Sort

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

Query More Than One Table

Example: List all observation ratings and gender of participants.

Primary & Secondary SortExample: List ratings by gender.

Within gender, sort by ID then Date.

Segment E:Selection Criteria

Select RecordsExample: List demographics of Female participants.

Selection Criteria: Operators

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

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.

Selection Criteria: NOT

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

Selection Criteria: NULL

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

Selection Criteria: Dates

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

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’?

Segment F:AND vs. OR

Selection Criteria: AND

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

Selection Criteria: OR

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

Combine Selection Criteria

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

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?