Select by attributes

The Select by Attributes tool is located on the main menu in Selection > Select by Attributes, or also within the attribute table of each layer: Right-click layer > Open Attribute Table > Table Options text icon11 > Select by Attributes. This tool allows the user to select a set of data from a layer based on the attribute properties of the layer. In the following example, all the communes within the canton of Fribourg, Switzerland, will be selected because all of the honey bee colonies are within that canton.

  1. From the main menu, go to Selection.
  2. Click Select by Attributes.
  3. The input layer is the layer from which data will be selected. In this case, choose the commune_boundary_FR layer as input.
    There are multiple methods available:
    a. Create new selection,
    b. Add to current selection,
    c. Remove from current selection,
    d. Select from current selection.
  4. Choose Create new selection.
    In the next section there is a list of attributes corresponding to those of the input layer.
  5. Select the KANTONSNR attribute by double-clicking on the name.
  6. Click the equals =  button.
  7. Click the Get Unique Values button to see all the values in that attribute field. In this case, the values represent two cantons in Switzerland.
  8. Double-click the 10 to add it to the equation. In this example, 10 was clicked because that is the canton number for Fribourg.
  9. Now the SQL equation looks like this: SELECT * FROM commune_boundary_FR WHERE: “KANTONSNR” = 10 (Fig. 19).
  10. Click OK
  11. Open the attribute table of the layer from which data were selected (Right-click > Open attribute table).
  12. Click the Show selected records button to view the records corresponding to the selection text icon12.
  13. The selected records (49 out of 51) in the table match those selected on the map (Fig. 20).
  14. Now the selection can be cleared using the icon text icon13 to begin a new selection in the next section.

Fig. 19. The Select by Attributes dialog box with the commune boundary as the input and the SQL builder and resulting equation shown. In this example, the equation will select all records in the table with the canton number of 10.


Fig. 20.
The results of the Select by Attributes query (Fig. 19) are shown on the map and in the attribute table of the commune boundary layer. The turquoise highlights represent all the selected data which represent all communes in the canton of Fribourg.