List:General Discussion« Previous MessageNext Message »
From:Ferindo Middleton Date:October 6 2006 2:01am
Subject:Re: multiple primary keys on one table?
View as plain text  
Thanks. I now have this issue where I can't create the unique index on this
table because the email_address is often times blank or unknown for a while
(The front-end_application sets is value to '' (blank) on inserts and
updates if the user doesn't enter it so instead of going in as NULL, the
field gets a blank field value...

Is there a way to get UNIQUE index to treat blank data fields that are part
of the index as null and not enforce the constraint if the subject columns
are blank (whitespace)... Do I need to force the application to not pas the
value into the field and make it NULL instead.

just ferindo

On 10/5/06, Dan Buettner <drbuettner@stripped> wrote:
> Ferindo, you can create multiple UNIQUE indexes on a table to enforce
> your data requirements.
> Dan
> On 10/5/06, Ferindo Middleton <ferindo.middleton@stripped> wrote:
> > I have a primary key set on a table which consists of the combination of
> the
> > values: firstname, lastname, and a schedule_id (BIGINT(20))... I have
> this
> > so the records in this table do not have duplicates, being that no one
> > record should have the exact same name and schedule_id identifier.
> >
> > However, I want to keep this same restriction while also ensuring that
> no
> > two records have the same email_address and schedule_id identifier...
> >
> > You can't have the db enforce two different primary keys on one table,
> so
> > how would I implement having this kind of restriction, which, in itself,
> > seems to require that I have a second primary key to enforce another
> > constraint to dissalow records to be added that carry the same
> combination
> > of: email_address and schedule_id?
> >
> > just ferindo
> >
> >

multiple primary keys on one table?Ferindo Middleton5 Oct
  • Re: multiple primary keys on one table?Dan Buettner5 Oct
    • Re: multiple primary keys on one table?Ferindo Middleton6 Oct
      • Re: multiple primary keys on one table?Gabriel PREDA6 Oct
  • Re: multiple primary keys on one table?Miles Thompson6 Oct
  • Re: multiple primary keys on one table?Martijn Tonies6 Oct
  • Re: multiple primary keys on one table?Renish6 Oct