Skip site navigation (1) Skip section navigation (2)

setting up a table relationship

From: Mag Gam <magawake(at)gmail(dot)com>
To: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: setting up a table relationship
Date: 2010-06-26 21:55:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I have some data like this

Task A:started at 5:30AM:ended 6:00AM
Task B:started at 5:30AM:ended 7:00AM
Task C:started at 5:45AM:ended 6:00AM
Task D:started at 7:30AM:ended 11:00AM

Task A:started at 1:30AM:ended 6:00AM
Task B:started at 1:30AM:ended 7:00AM
Task C:started at 2:45AM:ended 6:00AM
Task D:started at 3:30AM:ended 11:00AM

Task A:started at 3:30AM:ended 6:02AM
Task B:started at 4:30AM:ended 7:04AM
Task C:started at 8:45AM:ended 12:04PM
Task D:started at 7:30AM:ended 11:01AM

I would like to do metric such as, "On 2010/06/25 what was the longest
task", "how does task B look for X number of days", etc..

I setup 2 tables, task and t. Task is for the task and t is for the time.

Now, I am getting confused on how to setup this relationship. This
should be a many-to-many relationship. Can anyone give me advise on
how to better organize this data?



pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2010-06-26 22:16:49
Subject: Re: setting up a table relationship
Previous:From: Jean-Yves F. BarbierDate: 2010-06-26 21:21:59
Subject: escape

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group