Given a table of values, such as C.Wunsch's data from GEOSECS Station 3, with an added column of a fictional date_time added to enable the examples:
date_time press temp sal O2 Sigma0
------------------------------------------------------
199408031130 5.000 18.334 33.570 5.970 24.096
199408031145 25.000 12.848 34.159 6.990 25.773
199408031200 49.000 11.070 34.523 6.060 26.394
199408031230 99.000 11.093 35.090 5.340 26.831
199408031330 149.000 11.906 35.487 5.020 26.990
...
A selection can be defined as choosing record instances which
satisfy certain criteria. In other words, a selection determines which rows to include in operations which follow.
Example of a numeric selection:
- Your selection is: press>50
- which translates to "all values with a pressure value exceeding 50"
- The result is:
date_time press temp sal O2 Sigma0
------------------------------------------------------
199408031230 99.000 11.093 35.090 5.340 26.831 correct, numerically
199408031330 149.000 11.906 35.487 5.020 26.990 the values for press
... exceed 50
Example of a string selection:
- Your selection is: date_time ge 199408031200
- which translates to: "all values which occured at noon or after on August 3, 1994"
- Note: string selections are accomplished by comparing values as they occur in the ASCII table
- The result is:
date_time press temp sal O2 Sigma0
------------------------------------------------------
199408031200 49.000 11.070 34.523 6.060 26.394
199408031230 99.000 11.093 35.090 5.340 26.831
199408031330 149.000 11.906 35.487 5.020 26.990
...
Example of a how NOT to use a string selection:
- Your selection is: press lt 50
- which translates to "left-justifying, return all values with a pressure which would occur before 50 in the ASCII table"
- The result is:
date_time press temp sal O2 Sigma0
------------------------------------------------------
199408031130 5.000 18.334 33.570 5.970 24.096
199408031145 25.000 12.848 34.159 6.990 25.773
199408031200 49.000 11.070 34.523 6.060 26.394
199408031330 149.000 11.906 35.487 5.020 26.990 correct! "1" is lower than "5"
...
*** Lesson: When dealing with values which are numbers and which are meant to be used arithmetically, use a numeric selection.
A projection can be defined as choosing which parameters to use from among all available parameters. In other words, you can determine to see only some of the columns in a table.
Example:
- Your projection is: press, temp, O2
- The result is:
press temp O2
-----------------------
5.000 18.334 5.970
25.000 12.848 6.990
49.000 11.070 6.060
99.000 11.093 5.340
149.000 11.906 5.020
...
These two query types can be used in combination to further specify a subset.
Example combining selections and projections:
- Your subset is: temp < 15, press, temp, O2
- The result is:
press temp O2
-----------------------
25.000 12.848 6.990
49.000 11.070 6.060
99.000 11.093 5.340
149.000 11.906 5.020
...
Return to Help on Subselections