Presentation is loading. Please wait.

Presentation is loading. Please wait.

ACCESS PROJECT TWO. PROJECT ONE In project one you: -Created Tables -Created Forms -Created Reports In this project you will learn about queries. Databases.

Similar presentations


Presentation on theme: "ACCESS PROJECT TWO. PROJECT ONE In project one you: -Created Tables -Created Forms -Created Reports In this project you will learn about queries. Databases."— Presentation transcript:

1 ACCESS PROJECT TWO

2 PROJECT ONE In project one you: -Created Tables -Created Forms -Created Reports In this project you will learn about queries. Databases are meant to be searched to retrieve information, and that is what queries are – searches.

3 Queries Queries are used to find the answers for questions like: - Who hasn’t paid their bill? -How many clients do we have in Saskatoon? -How many of our client have spent more than $200.00 in our company?

4 1. To begin this project, open the Fishley Inc database that you created in IP10. Then look for the Queries option on the database window and choose Create query using Design View.

5 2. You should now see this screen. Choose Client and select Add, and then close the Show Table window.

6 3. Click on the Maximize button to expand the window. Then adjust the size of the Client Field List and the size of the panes by dragging the Dividing Line.

7 4. Now we are ready to add fields to the Design Grid to answer a question or retrieve information. We would like to find out the Technician for each Client. This means we need to include the Client Number, Name, and Technician Number. To include a field, we simply double-click on the field we want.

8 5. Once we have added the desired fields, we RUN the query by clicking the Run button.

9 Our query should look like this: Click on the disk to save it, and call it query 1. Click on the blue triangle button to get back to design view.

10 6. Click on the Edit Menu and choose Clear Grid to empty the design grid. Then click on the asterisk (*) field. This will enter only Client* into the design grid. But when we run the query, watch what happens.

11 It displays the whole table. Save this as Query 2 using the disk icon and click on the blue triangle to get back to design view. Then clear your grid.

12 7. Next, let’s find out how much client DP34 has been Billed and how much client DP34 has Paid. Notice that we have listed DP34 as a Criteria for the search under the Client Number field.

13 Run the query – it should appear as shown below. Save it as query 3 and go back to Design View using the blue triangle icon. Then clear your grid.

14 8. Suppose that we want to find out which clients have names beginning with the letter “H”. To do this we used what is called a WILDCARD. This allows us to specify that we want the first however many criteria to match, but the rest of the characters don’t matter. To do this we use an asterisk (*) to represent a character or a combination of characters.

15 Run the query – it should appear as shown below. Save it as query 4 and go back to Design View using the blue triangle icon. Then clear your grid.

16 9. Suppose that we want to find all of the people who live in Saskatoon. However, since we know the city is Saskatoon, we do not want to display the city. We still need to use the field in our search, but do not want to display the field. To do this we add “Saskatoon” to the City criteria line, and click on the checked box for that field. This removes the check mark and therefore will not show the field.

17 Run the query – it should appear as shown below. Save it as query 5 and go back to Design View using the blue triangle icon. Then clear your grid.

18 10. Suppose that we want to find all of the clients who have not paid anything toward their bill. To do this we add 0 to the Paid criteria line.

19 Run the query – it should appear as shown below. Save it as query 6 and go back to Design View using the blue triangle icon. Then clear your grid.

20 11. Suppose that we want to find all of the clients who have been billed more than $300. To do this we use the signs and type >300 in the Billed criteria line.

21 Run the query – it should appear as shown below. Save it as query 7 and go back to Design View using the blue triangle icon. Then clear your grid.

22 12. Suppose that we want to find all of Technician 02’s clients who have been billed more than $300. To do this we use the signs and type >300 in the Billed criteria line and type 02 in the criteria line of the Technician Number field.

23 Run the query – it should appear as shown below. Save it as query 8 and go back to Design View using the blue triangle icon. Then clear your grid.

24 13. Suppose that we want to find all of the clients who have been billed more than $300 OR all of the clients who belong to Tech 2. To do this we use the signs and type >300 in the Billed criteria line and type 02 in the OR line of the Technician Number field.

25 Run the query – it should appear as shown below. Save it as query 8 and go back to Design View using the blue triangle icon. Then clear your grid.

26 14. Suppose that we want to find an alphabetical list of the cities we serve. To do this we use the City field and use the SORT line on the field. Then we choose Ascending.

27 Run the query – it should appear as shown below. Save it as query 9 and go back to Design View using the blue triangle icon. Then clear your grid.

28 15. Notice on the last query that some cities were listed twice. To fix this problem we need to alter our query slightly. Click in the Field row of the empty column next to city. It will bring up a menu – choose Properties. Then find Unique Values and select Yes. Click on the red X button to close Properties. Everything else in the query stays the same.

29 Run the query – it should appear as shown below. Save it as query 10 and go back to Design View using the blue triangle icon. Then clear your grid.

30 16. Suppose we wanted to create a list of all of the clients sorted by technician and listed from those who have been billed the most to those who have been billed the least. To do this we include the Client Number, Name, Technician Number, and Billed fields.

31 Run the query – it should appear as shown below. Save it as query 11 and go back to Design View using the blue triangle icon. Then clear your grid.

32 17. Suppose we wanted to create a list with information from both tables. To do this we must first add the Technician Table and join it to the Client Table. Go up to the QUERY menu and choose Show Table. Select the Technician Table and resize the windows appropriately. Notice that there is a dark line connecting the Technician Number field on the Client Table to the Technician Number field on the Technician Table.

33 Our next step is to select/add the Client Number, Name, and Tech Number fields from the Client Table and the Last Name and First Name fields from the Technician Table.

34 Run the query – it should appear as shown below. Save it as query 12 and go back to Design View using the blue triangle icon. Then clear your grid.

35 18. Next, suppose that we wanted to create a list of technicians which have billed clients more than $300. Create the following query.

36 Run the query – it should appear as shown below. Save it as query 13 and go back to Design View using the blue triangle icon. Then clear your grid.

37 19. Suppose that we want to find out how much money is owing to the company. We can use Access to calculate a field. Create the following query.

38 Then right-click in the field row of the third column and choose Zoom off of the shortcut menu. The following window will appear. Enter the text as shown below and click “OK”.

39 The following design grid will appear; run the query.

40 Run the query – it should appear as shown below. Save it as query 13 and go back to Design View using the blue triangle icon. Then clear your grid.

41 20. Suppose that we want to find out the average amount that the technicians have billed. To do this we need to add a Totals row to the design grid. To do this we right-click on the grid and choose Totals. Then add “Billed” to the design grid.

42 We choose AVG (or average) and then run the query. The result of our query should look like this:

43 21. Suppose that we want to find out the average amount that Technician 12 has billed. To do this we add the tech number field and choose Where off of the Totals list. Then put 12 in the Criteria field. Run the query. The result of our query should look like this:

44 22. Suppose that we want to find out the average amount that each Technician has billed. To do this we clear the grid. Then we add the Tech Number field and the Billed field. Choose Group By under the Tech Number field, and Avg under the Billed field. Run the query. The result of our query should look like this:

45 Saving a Query Access will allow you to save your queries. Make sure you name them so that you know what the query contains.


Download ppt "ACCESS PROJECT TWO. PROJECT ONE In project one you: -Created Tables -Created Forms -Created Reports In this project you will learn about queries. Databases."

Similar presentations


Ads by Google