Access: Sorting, Filtering, and Querying

Download Report

Transcript Access: Sorting, Filtering, and Querying

Classwork: Common Errors
• Primary keys: don’t forget them!
• Primary keys: choose the best one!
– “Name” and “birthday” are not the best choices.
– “Phone number” was a little better.
– The best primary key was an ID, with the data type
of “Autonumber.”
• Data types: don’t be lazy!
Quiz: Common Errors
•
•
•
•
Horizonal/Vertical
LAN/WLAN – not necessarily on the internet!
SPELLCHECK
READ THE QUESTIONS (especially “how?”
questions!)
• Explaining things, giving details
• Thing, something
Access: Sorting, Filtering, and
Querying
A quick note
• We have worked with one table
• A real database will have many tables.
Remember our vocab
• Field: one column in a database, all having the
same data type.
– Like Name, ID, and so on
• Record: all of the data for one entry
– All of the data about one friend: their name,
address, phone number, and favorite food.
Looking for data
• With a database of one table and 5 records,
it’s easy to find information
But what about now?
Our tools
•
•
•
•
Find
Sort
Filter
Query
Find
•
•
•
•
The simplest option
We search for one data field
EditFind
Ctrl+F
Find Options
• Find What: what you are looking for
• Look In: search the whole table, or the
selected field?
Find Options 2
• Match:
– Any Part of Field – anywhere in the field.
• “John” will find “John Smith,” “Smith, John,” and
“sdfasdfJohnasfgasgfd.”
– Whole Field – exactly your text only
• “John” will only find “John.”
– Start of Field – only the beginning
• “John” will find “John Smith,” but not “Smith, John.”
Find and Replace
• Same as Find, but will change the information
for you.
Sort
• A table will be displayed in the order that the
data is entered
• You can change the order the records are
displayed – this is sorting.
RecordsSort
Filter
• A filter will show only records containing the
information you choose.
• Right click on the data you want, and choose
“Filter by Selection”
Filter results
Removing the filter
• To go back to the full table
Review
• Find: takes us to a particular data value
• Sort: shows the records in a certain order
• Filter: shows us only the records containing a
certain data value
Query
• Query: to ask a question
• Queries are what make a database special –
you can quickly find any combination of data
you want.
• This leads us to a field of study called Data
Mining
Data Mining
• Searching large amounts of data to find
interesting relationships.
• Used in
– Marketing
– HR
– Biology
– National Security
Creating a query
Show table
• Here you choose which table(s) you are asking
questions about
Adding a search term
• Double click on the top window to add a
search term to the query.
Continue to build the query
Sort, Show
• Sort: as we learned before
• Show – if it will be displayed
Final Query
• This will display our employees in order of
hiring.
Close and save, then run the query
And we get our results
Uses?
• Get just the data you need quickly
• Put together information from different tables
• Export the data to another program
For example…
Now in Excel!
• Find the information needed
• Then do calculations