Presentation is loading. Please wait.

Presentation is loading. Please wait.

Access Query Design. IT Fundamentals2 Access Query Design The Query design screen provides a mechanism for selecting specific data from datafile(s) by:

Similar presentations


Presentation on theme: "Access Query Design. IT Fundamentals2 Access Query Design The Query design screen provides a mechanism for selecting specific data from datafile(s) by:"— Presentation transcript:

1 Access Query Design

2 IT Fundamentals2 Access Query Design The Query design screen provides a mechanism for selecting specific data from datafile(s) by: displaying only selected fields (Can also change the order of fields) only records that match given criteria reorder records can also link across multiple files

3 IT Fundamentals3 Access Query Design Open Access Query Screen Open the Database Click “Queries” Choose “Create query in Design View” Click ”Design” choose tables to add Click “close”

4 IT Fundamentals4 Design screen: contains top section which shows the tables to be used in the query Bottom section: contains fields and criteria used in the query Access Query Screen

5 IT Fundamentals5 Access Query Screen (cont.) Selecting Fields: Highlight the field in the active table. ( Double Click ) Drag the field from the active table and drop it in the field view skeleton. (Choose) Selecting Records: CRITERIA Enter criteria into bottom section of the query design screen. Character field: Data is entered into the file skeleton as is or encased in quotes. Can also retrieve a range of values: eg. < "M"

6 IT Fundamentals6 CRITERIA Retrieve all employees who are in Back department

7 IT Fundamentals7 CRITERIA (CONT.) Numeric field: eg. Retrieve all records with pay_rate <= 8.50

8 IT Fundamentals8 Date Fields: eg. before 27th July 1987 is entered as<27/07/87 CRITERIA (CONT.)

9 IT Fundamentals9 CRITERIA (CONT.) Logical Fields: Enter Yes or No Note: NO quote marks (“) – “Yes” (WRONG), Yes (CORRECT) Retrieve all employees who are union members

10 IT Fundamentals10 Condition1 AND Condition2 Enter conditions on the same line. eg.Department=“Back" AND Pay_Rate > 7.00 MULTIPLE CRITERIA

11 IT Fundamentals11 MULTIPLE CRITERIA (CONT.) Output:

12 IT Fundamentals12 MULTIPLE CRITERIA (CONT.) eg2. Pay_Rate between 7.00 AND 9.50

13 IT Fundamentals13 MULTIPLE CRITERIA (CONT.) Output:

14 IT Fundamentals14 MULTIPLE CRITERIA (CONT.) Condition1 OR Condition2 Enter conditions on different lines in file skeleton: Eg. Department is either “Back" OR "Centre"

15 IT Fundamentals15 MULTIPLE CRITERIA (CONT.) Output:

16 IT Fundamentals16 MULTIPLE CRITERIA (CONT.) Eg. 2 Department is either “Back” OR Pay_rate >9.00

17 IT Fundamentals17 MULTIPLE CRITERIA (CONT.) Output:

18 IT Fundamentals18 SORTING RECORDS Access allows you to sort the output in ascending or descending order on character, numeric & date fields.

19 IT Fundamentals19 SORTING RECORDS (CONT.) Example 1: Sort all employees in ascending order according to Name. Show Name, DOB & Department

20 IT Fundamentals20 SORTING RECORDS (CONT.) Output:

21 IT Fundamentals21 SORTING RECORDS (CONT.) Example 2: Sort all employees in ascending order according to Name within each Department. Show Name, DOB & Department

22 IT Fundamentals22 SORTING RECORDS (CONT.) Output:

23 IT Fundamentals23 SHOWING RECORDS Tick the SHOW box if you want the field to be displayed. Note: Not all SHOW boxes should be ticked.

24 IT Fundamentals24 SORTING RECORDS (CONT.) Output:

25 IT Fundamentals25 CALCULATION FIELDS Retrieve all employees whose Salary exceed 250. Here the Salary = Pay_Rate*HOURS_WORK. Note:In the Field row of a new column enter: Salary: PAY_RATE*HOURS_WORK Or: Right-Click the Field row of a new column choose “Build” Open an Expression Builder window

26 IT Fundamentals26 Expression Builder window

27 IT Fundamentals27 In the query design view, rename “Expr1” as “Salary”

28 IT Fundamentals28 CALCULATION FIELDS Output:

29 IT Fundamentals29 LAB 6 Checking you Data file Make sure they are the same as in Page93 Do Lab6 “Access Queries” on Page94~99 Save your result in “c:\homework”


Download ppt "Access Query Design. IT Fundamentals2 Access Query Design The Query design screen provides a mechanism for selecting specific data from datafile(s) by:"

Similar presentations


Ads by Google