database design SQL prob.

Поиск
Список
Период
Сортировка
От Frederic.De.Leersnijder@pandora.be
Тема database design SQL prob.
Дата
Msg-id 199907221247.IAA52530@hub.org
обсуждение исходный текст
Список 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
subscribingtwice. That's why I used a primary key on the fields firstname, lastname, adres, zipcode. But I would really
wantmember_id to be my primary key as the table is referenced by other tables. Can I make firstname, lastname... a
uniquevalue 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));

В списке pgsql-sql по дате отправления:

Предыдущее
От: root
Дата:
Сообщение: (no subject)
Следующее
От: "D'Arcy" "J.M." Cain
Дата:
Сообщение: Re: [SQL] calculating percentages