On Tue, Aug 10, 2010 at 04:15:38PM -0400, luis cota wrote:
> Correct - ID is referring to the primary key in the table. If I insert a
> data point(date, id, value), it is possible that I will update this point at
> a later date. I can manually check in code for existence of the date, id
> pair, though I was wondering if there was another way to do this, or if
> there was already a way to impose such a constraint.
Then create an index.
> On Tue, Aug 10, 2010 at 2:37 PM, Oleg Broytman <ph...@ph...> wrote:
>
> > On Tue, Aug 10, 2010 at 02:16:26PM -0400, luis cota wrote:
> > > How can I ensure that there exists only one value for a given Date, ID
> > pair?
> >
> > In general, by creating a unique index on (date, id) pairs; you can
> > create the index directly in SQL or in SQLObject.
> > But in this particular case... you say ID - do you mean the primary key
> > for the table? Well, it's itself a unique key, you don't need to make
> > (date, id) pairs more unique.
Oleg.
--
Oleg Broytman http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|