Download No 44
Transcript
East Usambara Biodiversity Database: A User’s Manual 4.5.iii The Not Operators You use the Not operator to identify the records that do not meet a specified criterion. For example, you can tell Access to identify all the small mammals that are not rodents. a) Start a new query, this time select the MAMMALS table. Add the KMH No, Taxon Id, Genus and species to the QBE Grid. b) In the criteria row of the Taxon Id field, type Not rodent. c) Run the query. The Datasheet shows only those mammals that are not listed as rodents. 4.5.iv The Null Operator You use the Null operator to identify records that have no value in a specific field. If the database manager wanted a list of records with no KMH number from the AMPHIBIANS table, she / he could use the Null operator. For example: a) Start a new query, this time select the Amphibians table. Add the KMH No. Genus and species fields to the QBE Grid. b) In the criteria row of the Genus field, type Is Null. In the species column go to the ‘or’ row and also type Is Null. c) Run the query. The Datasheet shows all records for which there is either no genus or no species. 4.6 Sorting with Queries A basic feature of databases is the ability to sort data so that you can look at it in different ways. We looked at using the Sort Ascending and Sort Descending buttons in tables. However to sort on more than one column using this method, you have to rearrange the columns. Using a query, you can sort the table based on any criteria. For example, suppose you want to list the trees alphabetically by Forest Reserve and then by genus and species: a) Start a new query using the trees > 10 cm dbh table. Add FR Code, Genus and Species to the QBE grid. b) Click the sort row of the FR Code column, click the arrow button and select Ascending. c) Repeat Step b for the Genus and species field names. d) Run the query. If you want to use more than one field to sort the data e.g. genus and then species you need to make sure that you place the fields in the QBE grid in the correct order. Access will work from left to right i.e. it will sort all the data first by the field that is furthest left in the grid. It will then move to the right for the next column by which to further sort the data and so on. 4.7 Updating records with queries From time to time, you may want to change a value in several records in a table. For example you realise that there is a new synonym for a tree species for example we might want to change all Celtis wightii to their current name Celtis philippensis. You could update each record in turn, but an easier way is to use an update query. Follow these steps: a) With ‘trees > 10 cm dbh’ in the Tables list of the Database window, choose Query from the New object button’s dropdown list. This button is usually to the right hand side of the tools menu and has a drop down list arrow beside it. b) Click OK to open a new query based on the ‘trees > 10 cm dbh’ table in design view. c) Double-click the genus and species fields to add to the QBE grid. d) Select Update Query from the Query Type button’s dropdown list. Access changes the select query to an update query by adding an Update To row to the QBE grid. e) In the Update To row of the species column type ‘philippensis’. 21