Database Reference
In-Depth Information
10
In the message box, click No to cancel the deletion. Two discontinued records cannot
be deleted because they have entries in the Order Details table. If this were a real
database, you would need to decide whether to set the Discontinued field of these
products to No (clear their check boxes) or to delete the entries from the Order
Details table before allowing the query to delete the product records.
Suppose you are concerned that someone might accidentally run this delete query
and destroy records you aren't ready to destroy. Let's change the query back to a
select query before saving it.
11
On the Design tool tab, in the Query Type group, click the Select button. Notice that
in the query design grid, the Delete row has disappeared and the Sort and Show
rows are now displayed.
12
Save the query with the name Delete Discontinued Products .
TIP If you want to delete obsolete records in the future, open the select query in
Design view, convert it to a delete query, and then run it.
CLEAN UP Close the query, and then close the GardenCompany07 database.
7
Key points
Create a query to display specific fields from specific records from one or more tables.
You can save the query for later use.
You can use wizards or create queries manually in the Query Designer.
Queries can use aggregate functions such as Sum and Avg to summarize data, and
they can perform calculations on matched data.
An update query performs an updating action on its results, such as replacing the
contents of a field.
A delete query deletes records that meet specific criteria. Use caution with this type
of query; the effects can be far reaching, and you can't recover deleted records.
Search WWH ::




Custom Search