Querying is done using a language called SQL. A description
of SQL is beyond the scope of this document but one, somewhat more
advanced, SQL feature is worth mention. Because the Gombe-MI
system stores all data of a like kind together, in one table, it
is often desirable to reference the same table (or table-like
structure) more than once in a single query. The
SQL AS syntax can be used to give a table an
alternate name used elsewhere within the query, allowing a single
table to be referenced multiple times within a single query. For
example, self-grooming data can be queried from the
ASOCIAL_EVENTS view. To count the number of
times both the mother and the infant simultaneously self groom the
following query uses AS so that
ASOCIAL_EVENTS can be used twice:
Example 1.4. Using AS in an SQL query: Reference
ASOCIAL_EVENTS twice to count the number of times a mother and
infant simultaneously self-groom
SELECT COUNT(*)
FROM asocial_events AS mom_events
, asocial_events AS infant_events
WHERE mom_events.intid = infant_events.intid -- Same interval
AND mom_events.function = 'M' -- Mom is mom
AND mom_events.behavior = 'G'
AND infant_events.function = 'I' -- Infant is infant
AND infant_events.behavior = 'G';
The use of AS in queries, or other, more
cumbersome techniques such as the creation of temporary tables,
reduces the number of views which must be created and
maintained.