Received: from hercules.telenet-ops.be (hercules.telenet-ops.be [195.130.132.33]) by hub.org (8.9.3/8.9.3) with SMTP id IAA52530 for ; Thu, 22 Jul 1999 08:47:58 -0400 (EDT) (envelope-from Frederic.De.Leersnijder@pandora.be) Date: Thu, 22 Jul 1999 08:47:58 -0400 (EDT) From: Frederic.De.Leersnijder@pandora.be Message-Id: <199907221247.IAA52530@hub.org> Received: (qmail 13129 invoked from network); 22 Jul 1999 12:47:57 -0000 Received: from unknown (HELO venus) ([195.130.148.230]) (envelope-sender ) by hercules.telenet-ops.be (qmail-ldap-1.03) with SMTP for ; 22 Jul 1999 12:47:57 -0000 X-Mailer: SendM@ail (Unlicensed) V1.09 To: pgsql-sql@postgreSQL.org Subject: database design SQL prob. Content-Type: text 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));