CIT12 – Queries
Last week you created a table in an Access database. This week, I want you to query the
database. If the data you have in the
database does not give you meaningful results when you do the queries, then you
should add some records.
These are the queries you should do:
- Do a
query where you only show some of the fields. This query should show all of the records so you do not have
to use criteria.
- Do a
query where you show some of the fields. Test one of the fields so you
only show records that meet the criteria.
For example, if you have an age field you can show all people over
45.
- Do a
query where you show all people that meet two criteria. These criteria should be in an AND
relationship. For example if you
have age and gender you could ask for all people over 45 who are M. Remember that when you test for numeric
fields you do not put quotes around the criteria but when you test for
character fields you do put quotes around the criteria.
- Do a
query where you show all people that meet one of two criteria. These should be in an OR
relationship. For example you
might look for all people who live in MA or RI if you have a state field. Another example might be all people who
are either over 45 or live in RI.
- Do a
query where you show all people that meet one criteria and one of two
other criteria. For example, you
might look for all people who live in MA and are either over 45 or F.