Presentation is loading. Please wait.

Presentation is loading. Please wait.

Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013 Day 16: Access Chapter 2 Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013.

Similar presentations


Presentation on theme: "Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013 Day 16: Access Chapter 2 Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013."— Presentation transcript:

1 Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013
Day 16: Access Chapter 2 Larry Reaves October 9, 2013

2 Administrative Exam 1 is graded. Some assignment 3 grades are available. All should be finished tonight. Midterms will be submitted to STAR by Friday for any student with a D or F Bonus points are not included The last day to drop a course this semester is Friday, October 25th. After that date, you will receive whatever grade you earn.

3 Last class Database design principles Tables Fields Field Properties
Primary/Foreign Keys Referential Integrity/Cascades

4 Basic queries A query is a question about the data stored in a database Decide which table (or tables) holds the information you would like to retrieve Decide which fields you are interested in Filter your results Sort your results

5 Single table queries There are two ways to create a simple query on one table Simple Query Wizard Create->Queries->Query Wizard Query Design View Create->Queries->Design View

6 Query Design View Field row: displays field name
Table row: specifies the table the field belongs to Sort row: enables you to sort by the field Show row: controls whether the field will be shown Criteria row: used to filter which records will be selected

7 Filtering (Criteria) For text fields, the criteria must be enclosed in “quotation marks” Wildcards; ? stands for any single character, * stands for any group of characters Comparison operators: equal =, not equal <>, greater than >, less than <, greater than or equal to >=, less than or equal to <= Is Null matches empty fields, Is Not Null matches non empty fields

8 Multiple criteria Criteria on the same row are combined using AND
Criteria on separate rows are combined using OR Criteria can be prefixed with NOT to exclude instead of include matching records You can also use AND within one criteria to put multiple conditions on one field

9 Sorting results Each field can be sorted in ascending (0-9, a-z, etc.) or descending (9-0, z-a, etc.) order The sorting is done from left to right Sorting by multiple fields only changes the order if there are multiple results where the first sort field has the same value

10 Copying queries Sometimes you need two similar queries. After you create the first one, you can easily make a copy that you can make changes to Open query->File->Save Object As Right click on the query in the Navigation Pane->Copy, right click on an empty space in the Navigation Pane->Paste

11 Running Queries Two ways to run queries from Design View
Query Tools->Design->Results->Run Right click query tab->Datasheet View Some queries may take a few minutes to run if there is a lot of data in the tables it is using

12 Multi-Table queries Queries can use fields from more than one table as long as all the tables used have a defined relationship Query Tools->Query Setup->Show Table If you try to use tables without a defined relationship, you will get a very large number of results. Since Access doesn’t know how records are related, it combines the records in every possible way. It one table has 5 records, and the other has 11, the query will return 55 records (unless your criteria narrows it down)

13 Next Class Calculated Fields Expression Builder Functions Aggregation
In queries In tables Expression Builder Functions Aggregation GROUP BY SUM, AVG, etc

14


Download ppt "Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013 Day 16: Access Chapter 2 Larry Reaves larry.reaves@mail.wvu.edu October 9, 2013."

Similar presentations


Ads by Google