One embodiment of the invention provides method for processing a database
query that includes an episode-based condition. The method includes
determining the time periods associated with one or more duration
episodes by analyzing a set of data reflecting values for the
episode-based condition captured at various points in time. An episode
definition may indicate the substantive data value associated with a
duration based event, and the data values used to determine a beginning
and ending date/time associated with each episode. Database queries that
include the episode-based condition may be composed by specifying a
desired value for the episode-based condition used in selecting query
results.