Home‎ > ‎3 pm class page‎ > ‎


Database Query

A database query is a way to find information within a database.  It is a request for specific data or a question that you ask the database.  Queries allow us to view data in many different ways.  Another use for a query is to analyze data or to change existing data.  It can be used to make forms or reports.  They are usually constructed using SQL (structured query language) which is an advanced programming language.  The word query means to question, to search, or to find.  When you query a database, you are looking for information in the database.

You can use a query to find any kind or combination of data within a database.  It could be as simple as finding all the people with a name starting with the letter C.  It could also be as complicated as finding all the men named Matt who are born in the month of August and have two brothers.

With a query, you can use a wildcard character such as an asterisk, to help find data.  The asterisk takes the place of a character or characters.  For example, if you are searching for any day in January, you could use 01/*/2011, or you could use wh* to find any word starting with the letters wh such as what, where, when, and many others.

Introduction to Database Query

There are 5 different types of queries.  Below are the list of queries and their features.

Select Query – A select query is used to sort or search for data within a database.  It searches the asked for data from one or more tables and then presents that data in the query datasheet in the specified order.  It is also the most common type of query.

Crosstab Query – The crosstab query condenses the data and then displays them in a row by column format that is easy to interpret.

Parameter Query – The parameter query displays a dialog box that asks you for information such as the criteria for locating data.  An example of a parameter query might be a request for a beginning and an ending date.  It would then display all the records that match the dates between the two specified values.

SQL Query The SQL query was created using SQL (Structured Query Language) which is a high-level programming language.

Action Query – An action query is used to revise many records in one process.  There are four types of action queries:

    Make-table Query - A make table query can take all or some of the information in a table and based on what information is desired, it will create another table with all or less of the original data.  It can be used to create a subset of data that may be easier to navigate.

    Update Query - An update query is used to change information within a database.  It would allow you to update existing records in a table.  For example, if you already had a birthday column, you can add data into that column.  Another possible use of an update query is when you need to raise the prices of all your products by 10%.

    Append Query - The append query can create a copy of data from one table and then add that information onto another table.  This allows merging tables with ease, without having to copy and paste everything.

    Delete Query - A delete query allows you to erase information in your database.  The query can be used to delete as little as one cell, or an entire table.

The make-table, update, append, and delete queries are known as action queries due to the fact that they are used to manipulate and/or change the data.  Action queries are irreversible, and the update and delete queries should be taken with caution as they modify the original data.  The append query modifies the data, but keeps all of the original data.  The make table query is the safest action query as no data is changed.  To learn more about action queries you can click here: Action Queries