Lesson 2: Queries with Pokémon

In this lesson, you will learn about how to use sorting and queries on a database of Pokémon to see how you can interrogate data in a database.

Learning objectives

  • Learn how to sort data in a database
  • Learn how to query a database to find specific records
  • Use a variety of numerical operators to do so
  • Create simple and complex queries to answer questions

Task: Gotta catch ’em all!

  1. Download Pokemon.accdb, save it into your Z:/ drive and open it in Microsoft Access.
  2. Open the Pokemon table and take a look at the data stored inside it.
  3. You’re going to answer some questions by sorting on certain fields.

Task: Thinking strategically…

  1. You can decide a lot by knowing your opponent.
  2. For each of the following questions, you need to pick the best Pokémon to go up against an enemy.
  3. Use the Pokémon type chart at this link to help you choose, and no cheating – you have to stick to the limits given!

Making queries

From this point on, rather than just using sort & filters to find the answers, you need to create queries. The great thing about queries is they can be saved so you can find answers quickly and easily time and time again.

For each of the tasks below, make a new query, giving it a name that makes sense and starts with qry_ (e.g. qry_thirdgengrass for the first task).

  1. Create a query to show all third generation grass Pokemon.
  2. Create a query to show all bug Pokemon with a special attack score over 50.
  3. Create a query to show all legendary flying Pokemon.

Reminder: numerical operators

When you want to find numbers over a certain value or between two values, you need to use numerical operators, just like you would in a spreadsheet, for example, >100 (over 100) or >=100 AND <=200 (greater than or equal to 100 and less than or equal to 200). Refresh your memory of numerical operators with the table below, and complete the quiz that follows to check your knowledge.

OperatorExplanation
>Greater than
<Less than
=Equal to
>=Greater than or equal to
<=Less than or equal to
<>Not equal to

Over to you!

Using the Pokemon database, try to come up with some devilishly difficult query challenges & swap computers with your friends to try and beat them. Present your challenges on the slides of a presentation, using Pokemon artwork to illustrate the challenges. There may be a prize for the biggest challenge!

Consolidation & practice

Sorting, filters & queries practice quiz