Types of Queries
Types of Queries
Types of Queries
stored in tables.
We can also use them as the source o f records for forms and reports.
A query is a request for data results, for action on data, or for both. You can use a query to answer a
simple question, to perform calculations, to combine data from different tables, or even to add,
change, or delete table data. Queries that you use to retrieve data from a table or to make
calculations are called select queries. Queries that add, change, or delete data are called action
queries.
When you want to review, add, change, or delete data from your database consider using a query.
Using a query, you can answer very specific questions about your data that would be difficult to
answer by looking at table data directly. You can use queries to filter your data, to perform
calculations with your data, and to summarize your data. You can also use queries to automate many
data management tasks and to review changes in your data before you commit to those changes.
Types of queries.
Various types of queries exist:
Select queries.
These are the queries that extract or show us data. They will show data that complies with specific
criteria.
Once we have the result we can consult the data and edit it (this can or cannot be done,
depending on the query). A select query generates a logical table (named this way because it is not
actually in the hard drive but in the memory of the computer, and every time we open it is
recalculated).
This is the most common type of query.
Action queries.
These are the queries that carry out changes to the records. Various types of action queries exist
to delete, update, insert data, and to create a new table from one existing table. Depending on what
the query performs, there are four types of queries:
Make-Table queries
Update queries
Append queries
Delete queries
A Make-Table query creates a new table with the records stored in one or more tables.
Update queries allow us to modify the data stored in a table. In only one operation, all the
records can be changed at the same time
Append queries are those queries that add whole rows to a table.
The new records are added at the end of the table.
We can insert one row or various rows at the same time, normally getting the data from another
table, and so an append query has a source (the table or tables where it gets the data from) and a
destiny (the table where we will insert the data). The mechanism is similar to that of a make-table
query in so far as we define a selection query which permits us to obtain the data to save, and what
does vary is that now we have to indicate into which column we want to save every value.