database

You are browsing the archives of database.

Introduction to Queries

Please consider supporting this site by purchasing items from the Book Store. Thanks for visiting!

In MS Access, what is a query?

This series of articles on MS Access Queries will start off from raw basics. Most of my regulars will already know this material, and so please allow for the fact that this is meant for “newbies” to some degree. I promise to get into more challenging topics as we go along.

Simply put, a query is a question asked of the database, specifically of one or more of the tables in the database. A query’s answer returns values from selected fields (columns) and records (rows).

A basic example could be, “Which of our customers are located in Springfield?”

A more complex query (or question) could be, “Which of our customers in Springfield have not ordered any products in the past 6 months?”

The above examples are of just one type of query; the select query. MS Access has a number of types of queries available.

This series of articles will be written based on Access 2000. Newer versions of Access may have added to this list. The principles explained here should work fine on version 2000 and any newer ones.

Types of Queries

If you create a query manually (more on this later) you choose from a list of 6 query types.

  • Select Query retrieves data from one or more tables (or queries!)
  • Crosstab query displays summarized data in a column/row format (like pivot tables in Excel)
  • Make Table query creates a new table based on data from one or more existing tables (or queries!)
  • Update query updates the data in a table (a simple example would be “Add an across the board raise of 2% to each employee’s pay rate”)
  • Append query adds new records (rows) to a table
  • Delete query will delete records (rows) from a table

Most of the above queries accept criteria (parameters) such that only some of the records in a table are retrieved or updated.

NEXT: How to create a basic query.

Access, FTP, PHP, MySQL – Part 3

Continuing with my series about using Access on a PC to feed a MySQL database on the web! Read part 3 here. This part describes the structure of the 2 databases involved. One is an MS Access database on a local PC. The other is a MySQL database on a webserver.

Remember that this method was created for websites that exist on servers that do NOT allow remote MySQL connections. Some servers do allow the remote connections, which simplifies the whole process.

Relational Database Design Guidelines

While designing a relational database, it is a good idea to distribute the information in multiple tables. It is not advisable to store all the information in a single table, although it is easier to design. When your database grows in size, the efficiency decreases accordingly.

To read the rest of this article, Relational Database Design Guidelines – an introduction.

Database Corruption

Have you ever had an Access database crash, and then not open again?

A database is said to be “corrupted” when a part of its data or functionality is lost. When an ACCESS database is corrupted, you may get several error messages while doing the common operations in ACCESS. For example, while opening and closing the database, while running forms or queries, while updating and saving records, or while scrolling through records. This is the indication that a part of your database is corrupted.

There are many reasons why this data or functionality corruption may occur.

(click here to read the rest of this article)

Filtering in MS Access

Although my favourite “filtering” method is the MS Access Query tool, I do use the Access Filtering method regularly as well. Here is an introductory discussion of Filtering in MS Access.