Re: Check for no more than two entries of each value in a column?
From: ddf <oratune_at_msn.com>
Date: Fri, 17 Apr 2009 12:20:26 -0700 (PDT)
Message-ID: <27b125db-4ead-4949-98a2-f1a611de0900_at_l16g2000vba.googlegroups.com>
On Apr 17, 12:40�pm, livefreeordie <jpittm..._at_gmail.com> wrote:
> Hi,
>
> I need to create an app where any given employee may nominate up to
> TWO other employees per year for an award. �This number could change.
>
> Now I could create a table like this:
>
> PK, U1 �nominator � � � � (varchar2(12))
> PK, U1 �year � � � � � � � � (int)
> U1 � � � �nomination1_id �(int)
> U1 � � � �nomination2_id �(int)
>
> Then another table:
> PK � nomination_id � �(int)
> � � � � nominee � � � � � (varchar2(12))
> � � � � nomination_data � ....
>
> However, this would force me to update any Views or Code every time
> the number of allowed nominations changes.
>
> I'd much rather do this:
>
> PK �nomination_id � (int)
> � � � �year � � � � � � � � (int)
> � � � �nominator � � � � (varchar2(12))
> � � � �nominee � � � � � (varchar2(12))
> � � � �nomination_data ...
>
> And have some kind of Check Constraint to only allow two nominees per
> nominator per year. �But I don't know how to do that.
>
> Thoughts?
>
> ~ Jamie
Date: Fri, 17 Apr 2009 12:20:26 -0700 (PDT)
Message-ID: <27b125db-4ead-4949-98a2-f1a611de0900_at_l16g2000vba.googlegroups.com>
On Apr 17, 12:40�pm, livefreeordie <jpittm..._at_gmail.com> wrote:
> Hi,
>
> I need to create an app where any given employee may nominate up to
> TWO other employees per year for an award. �This number could change.
>
> Now I could create a table like this:
>
> PK, U1 �nominator � � � � (varchar2(12))
> PK, U1 �year � � � � � � � � (int)
> U1 � � � �nomination1_id �(int)
> U1 � � � �nomination2_id �(int)
>
> Then another table:
> PK � nomination_id � �(int)
> � � � � nominee � � � � � (varchar2(12))
> � � � � nomination_data � ....
>
> However, this would force me to update any Views or Code every time
> the number of allowed nominations changes.
>
> I'd much rather do this:
>
> PK �nomination_id � (int)
> � � � �year � � � � � � � � (int)
> � � � �nominator � � � � (varchar2(12))
> � � � �nominee � � � � � (varchar2(12))
> � � � �nomination_data ...
>
> And have some kind of Check Constraint to only allow two nominees per
> nominator per year. �But I don't know how to do that.
>
> Thoughts?
>
> ~ Jamie
Answered in comp.databases.oracle.server. Posting to more than one newsgroup doesn't always get faster response.
David Fitzjarrell Received on Fri Apr 17 2009 - 14:20:26 CDT