[SQL] constraint question (I think)

2008-12-04 Thread Gary Stainburn
Hi folks. I'm trying to model a vehicle compound structure and have the following: Four seperate compounds, North, East, South and West, Each compound has a number of rows with Labels fastened to the fences As the compounds are not perfect rectangles, the rows are of differing lengths. I have

Re: [SQL] Constraint question

2006-05-19 Thread Markus Schaber
Hi, Andreas, Andreas Joseph Krogh wrote: >>CREATE UNIQUE INDEX foo ON onp_crm_businessfield_company(company_id) >>WHERE is_prefferred; > I also figured out that an index like this also works: > UNIQUE(company_id, is_preferred) > This works because NULL = NULL is false. But I guess your solution

Re: [SQL] Constraint question

2006-05-19 Thread Andreas Joseph Krogh
On Thursday 18 May 2006 18:38, Markus Schaber wrote: > Hi, Andreas, > > Andreas Joseph Krogh wrote: > > create table onp_crm_businessfield_company( > > businessfield_id integer not null references onp_crm_businessfield(id), > > company_id integer not null references onp_crm_relation(id), > > is_pre

Re: [SQL] Constraint question

2006-05-18 Thread Markus Schaber
Hi, Andreas, Andreas Joseph Krogh wrote: > create table onp_crm_businessfield_company( > businessfield_id integer not null references onp_crm_businessfield(id), > company_id integer not null references onp_crm_relation(id), > is_preferred boolean, > UNIQUE(businessfield_id, company_id) > ); > I

[SQL] Constraint question

2006-05-18 Thread Andreas Joseph Krogh
I have the following table: create table onp_crm_businessfield_company( businessfield_id integer not null references onp_crm_businessfield(id), company_id integer not null references onp_crm_relation(id), is_preferred boolean, UNIQUE(businessfield_id, company_id) ); I want a constraint on "is_pr