From: | Frederic(dot)De(dot)Leersnijder(at)pandora(dot)be |
---|---|
To: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | database design SQL prob. |
Date: | 1999-07-22 12:47:58 |
Message-ID: | 199907221247.IAA52530@hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
The idea of the table below is to keep track of members. They have to register themself so I want to prevent them from subscribing twice. That's why I used a primary key on the fields firstname, lastname, adres, zipcode. But I would really want member_id to be my primary key as the table is referenced by other tables. Can I make firstname, lastname... a unique value in another way?
Like constraint UNIQUE (firstname, lastname,adres,zipcode)
I just made that last one up but is it possible to enforce the uniqueness of a couple of fields together?
CREATE TABLE "member" (
"member_id" int4 DEFAULT nextval ( 'lid_id_seq' ) UNIQUE NOT NULL,
"firstname" text,
"lastnaam" text,
"adress" text,
"zipcoder" character(4),
"telephone" text,
"email" text,
"registration_date" date DEFAULT current_date NOT NULL,
"student_id" text,
"dep_id" text,
"password" text NOT NULL,
"validated" bool DEFAULT 'f' NOT NULL,
PRIMARY KEY (firstname, lastname, adres, zipcode));
From | Date | Subject | |
---|---|---|---|
Next Message | Ramn Yago | 1999-07-22 14:22:16 | Problem with large binary objects and Delphi |
Previous Message | root | 1999-07-22 10:17:08 | Problem with large objects |