Okay so right now I'm working on a program that has a whole bunch of event objects. Each event object has a start time and end time (both full timestamps). A lot of the events are contiguous (one event's endTime is the same as the next event's startTime) showing that the two events happened in succession. If I were to store all my events in a SQLite or MySQL table, would it be possible to query for each set of contiguous events?
Say my table looks like this.
id title start_time end_time
----------------------------------------------------------
1 Happy Time 4/3/2010 10:00:00 4/3/2010 13:00:00
2 Happier Time 4/3/2010 13:00:00 4/3/2010 18:00:00
3 Good Time 4/4/2010 18:00:00 4/4/2010 19:00:00
4 Gooder Time 4/4/2010 19:00:00 4/4/2010 22:00:00
5 Sad Time 4/6/2010 16:00:00 4/6/2010 20:00:00
I want to be able to query this table and see that id 1 and 2 are contiguous, id 3 and 4 are contiguous and id 5 is... contiguous with itself.
The reason I don't know where to start is because whenever I have worked with SQL queries, results were returned as individual rows. One row in the result is never part of a subgrouping.
If you have any questions feel free to comment. Thanks!