Database Toolbox    

Retrieving Unique Occurrences

In the Visual Query Builder Advanced query options, select Distinct to limit results to only unique occurrences. Select All to retrieve all occurrences. For example:

  1. Set Preferences; for this example, set Data return format to cellarray and Read NULL numbers as to NaN.
  2. Select the Data source; for this example, dbtoolboxdemo.
  3. Select the Tables; for this example, SalesVolume.
  4. Select the Fields; for this example, January.
  5. Run the query to retrieve all occurrences.
    1. In Advanced query options, select All.
    2. Assign a MATLAB workspace variable; for this example, All.
    3. Click Execute.
  6. Run the query to retrieve only unique occurrences.
    1. In Advanced query options, select Distinct.
    2. Assign a MATLAB workspace variable, for this example, Distinct.
    3. Click Execute.
  7. In the Data area, the Workspace variable - Size shows 10x1 for All and 8x1 for Distinct.
  8. In the Command Window, type All, Distinct to display the query results.

  1. The value 3000, appears three times in All, but appears only once in Distinct.


  Fine-Tuning Queries Using Advanced Query Options Retrieving Information That Meets Specified Criteria