Date post: | 21-Dec-2015 |
Category: |
Documents |
View: | 221 times |
Download: | 1 times |
Mark Dixon Page 1
02 – Queries: Query by Example
Mark Dixon Page 2
Questions: Databases
• Consider the following table:
a) How many records does it contain?
b) How many fields does it contain?
9
6
Mark Dixon Page 3
Session Aims & Objectives• Aims
– Introduce you to queries
• Objectives,by end of this week’s sessions, you should be able to:
– create a query using 'query by example' to:• extract a subset of records and fields from a database
table
Mark Dixon Page 4
Creating Queries: New Query• Select the database window
• Select queries option
• Double click on Create Query in Design view
Mark Dixon Page 5
Creating Queries: Add Table
• Click Add button
• Click Close button
Mark Dixon Page 6
Creating Queries: Add Fields
• Drag field names into query
Mark Dixon Page 7
View you Query
• Click View button
Mark Dixon Page 8
Return to Query Design
• Click View button again
Mark Dixon Page 9
Modify your Query
• Type in criteria
Mark Dixon Page 10
Criteria
• Massive variety – very powerful:> greater than
< less than
= equal to
>= greater than or equal to
<= less than or equal to
<> not equal to
Like "*or*" * means any text (i.e. contains "or")
Mark Dixon Page 11
Tutorial Exercise 1: Plants database• LEARNING OBJECTIVE:
to understand table, field, and record, so that you can create your own database with a single table containing several fields and records using MS Access
• TASK: Create the plants database (shown in earlier slide).
Mark Dixon Page 12
Tutorial Exercise 2: Plants database• LEARNING OBJECTIVE:
to understand queries, so that you can create your own query that displays selected fields and records from a table using MS Access
• TASK 1: Create the query (shown in earlier slide).• TASK 2: Experiment with Show, Sort and Criteria combinations