Upcoming SlideShare
×

# Search filterquery databases

491 views

Published on

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
491
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
7
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Search filterquery databases

1. 1. Search, Filter Query Module 7 Lesson 2
2. 2. Search: Filter v Query <ul><li>A method to find specific data within a database that meets certain criteria. </li></ul><ul><li>The difference? </li></ul><ul><ul><li>Queries can be saved and printed. </li></ul></ul>
3. 3. How do they work? <ul><li>Queries/Filters use connectors and comparison operators to define the search criteria </li></ul><ul><ul><li>Connectors (AND, OR, NOT) </li></ul></ul><ul><ul><li>Comparison operators (<, >, <=, >=, =, <>) </li></ul></ul>
4. 4. Comparison Operators <ul><li>= equals </li></ul><ul><li>< less than (no more than, fewer than) </li></ul><ul><li>> greater than (no fewer than, more than) </li></ul><ul><li><= less than or equal to (at most) </li></ul><ul><li>>= greater than or equal to (at least) </li></ul>
5. 5. Practice with Operators <ul><li>Which operator would be used? </li></ul><ul><li>Less than </li></ul><ul><li>More than </li></ul><ul><li>At least </li></ul><ul><li>At most </li></ul><ul><li>No more than </li></ul><ul><li>No fewer than </li></ul><ul><li>The same </li></ul><ul><li>Taller than </li></ul>Note your answers on a separate sheet of paper, then advance to the next slide.
6. 6. Answers <ul><li>Which operator would be used? </li></ul><ul><li>Less than < </li></ul><ul><li>More than > </li></ul><ul><li>At least >= </li></ul><ul><li>At most <= </li></ul><ul><li>No more than <= </li></ul><ul><li>No fewer than >= </li></ul><ul><li>The same = </li></ul><ul><li>Taller than > </li></ul>How did you do?
7. 7. Examples with a Database <ul><li>Which field would you search and which operator would be used? </li></ul><ul><li>Which billionaires are over 70 years old? </li></ul><ul><li>Field: Age Criteria: >70 </li></ul><ul><li>We are looking for a certain age which means we are looking in the age field. Our criteria is what we are looking for in that field, >70 </li></ul><ul><li>Which billionaires have a net worth of at least \$50 billion? </li></ul><ul><li>Field: Net Worth Criteria: >=\$50 </li></ul><ul><li>We are looking for a certain net worth which means we are looking in the Net Worth field. Our criteria is what we are looking for in that field, >=\$50 </li></ul><ul><li>How much is Bernard Arnault’s net worth? </li></ul><ul><li>Field: Name Criteria: “Arnault, Bernard” </li></ul><ul><li>We are looking for Bernard Arnault and he is located in the Name field. Since there is punctuation in the criteria, we must put quotation marks around it. </li></ul>
8. 8. Your Turn <ul><li>Which field would you search and which operator would be used? </li></ul><ul><li>Which billionaires are younger than 50 years old? </li></ul><ul><li>Field: __________ Criteria: ___________ </li></ul><ul><li>2. Which billionaires has a net worth of at most \$17 billion? </li></ul><ul><li>Field: __________ Criteria: ___________ </li></ul><ul><li>How old is Stefan Persson? </li></ul><ul><li>Field: __________ Criteria: ___________ </li></ul><ul><li>In which industry did Carlos Slim Helu earn his billions? </li></ul><ul><li>Field: __________ Criteria: ___________ </li></ul><ul><li>Which billionaires reside in the United States? </li></ul><ul><li>Field: __________ Criteria: ___________ </li></ul>Note your answers on a separate sheet of paper, then advance to the next slide.
9. 9. Answers <ul><li>Which field would you search and which operator would be used? </li></ul><ul><li>Which billionaires are younger than 50 years old? </li></ul><ul><li>Field: Age Criteria: <50 </li></ul><ul><li>2. Which billionaires has a net worth of at most \$17 billion? </li></ul><ul><li>Field: Net Worth Criteria: >=\$17 </li></ul><ul><li>How old is Stefan Persson? </li></ul><ul><li>Field: Name Criteria: “Persson, Stefan” </li></ul><ul><li>This one is tricky. Remember, you have to search the field of the criteria you are given. In this case, you are given Stefan Persson which is found in the Name field </li></ul><ul><li>In which industry did Carlos Slim Helu earn his billions? </li></ul><ul><li>Field: Name Criteria: “Slim Helu, Carlos” </li></ul><ul><li>Which billionaires reside in the United States? </li></ul><ul><li>Field: Residence Criteria: United States </li></ul><ul><li>So, be sure the criteria you search for is located in the field you are searching. Be very careful you are answering the question that is asked. </li></ul>
10. 10. Filtering in Access You can use the Advanced Filter. Record—Filter—Advanced Filter/Sort
11. 11. Filtering in Access Choose your field and your sort order Type the criteria here
12. 12. Filtering in Access Apply your Filter: Filter—Apply Filter/Sort
13. 13. Filtering in Access View the results! These are the billionaires that are older than 70 years old.
14. 14. Filtering in Access What if we wanted to do a Filter AND a Sort? Question: Of the billionaires over 70 years old, who is the wealthiest? Answer: Warren Buffet is the wealthiest billionaire over 70 years old. First, filter for Age >70, then sort Net Worth in Descending order.
15. 15. Video Demonstration: Filtering Click the button for a brief video. A new website will open, be sure to return to this presentation.
16. 16. Video Demonstration: Filtering Click the button for a brief video. A new website will open, be sure to return to this presentation.
17. 17. Connectors <ul><li>And must meet both criteria </li></ul><ul><li>yields fewer results </li></ul><ul><li>Or must meet either criteria </li></ul><ul><li> yields more results </li></ul><ul><li>Not except </li></ul>
18. 18. Connectors <ul><li>Which billionaires are at most 60 with a net worth of at least 20 billion? </li></ul><ul><ul><li>This is an AND search. Both criteria must be met. Use two fields and two criteria </li></ul></ul><ul><ul><li>Field: Age Criteria: <=60 </li></ul></ul><ul><ul><li>Field: Net Worth Criteria >=20 </li></ul></ul>
19. 19. Connectors <ul><li>Which billionaires were either born in the US or reside in the US? </li></ul><ul><ul><li>This is an OR question. Either criteria can be met. </li></ul></ul><ul><ul><li>Field: Country Criteria: United States </li></ul></ul><ul><ul><li>Field: Residence OR: Residence </li></ul></ul>
20. 20. Connectors <ul><li>Of the billionaires with at most 20 billion, how many are over 70? </li></ul><ul><ul><li>This is an AND question. Both criteria must be met </li></ul></ul><ul><ul><li>Field: Net Worth Criteria: <=20 </li></ul></ul><ul><ul><li>Field: Age Criteria: >70 </li></ul></ul>
21. 21. Queries in Databases <ul><li>Queries are database searches that can be saved and printed. </li></ul><ul><li>Queries are objects within a database. </li></ul><ul><li>Use fields and criteria to search the results like a filter, but you also specify which fields display in the results. </li></ul>
22. 22. Query a database Queries are Objects Open your database. Select Queries from the Object menu Select Create query in Design View
23. 23. Query a database Select a Table to base the Query. Select Add. Close the menu.
24. 24. Query a database Assign your fields and criteria to search or sort. Select any other fields to display.
25. 25. Query a database Run the Query. Select Query, then Run. Results will display.
26. 26. Query a database Save your Query. Provide a name for your Query. Click OK.