Page 4 of 9PREVNEXT

Queries I: Get started with queries

The process of designing a query

What you need to know, in plain(er) language.

So, how do you start building a query? The first step is to know the structure of your database, and the data in each table. You don't have to memorize every last record, but you do need to know where everything is. Open your tables and explore their fields and data.

Next, you design your query. An easy way to do that is to state the question you want your data to answer. The more detail you add to your question, the more precisely you can define your query. For example:

  • What's our most popular sales item in South America?
  • How many of my DVDs are on loan to friends?
  • Who's ordering the team jerseys this year, and what sizes do we need?

If it helps, write down your question and include as many field names as you can. For example: "I need the 10 best selling products in Malaysia. I need to know product names, product IDs, and the department that makes each item."

Once you have your question, you can build your query.

Page 4 of 9PREVNEXT