pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frederic.De.Leersnijder@pandora.be
To: pgsql-sql@postgreSQL.org
Subject: database design SQL prob.
Date: Thu, 22 Jul 1999 08:47:58 -0400 (EDT)
Message-ID: <199907221247.IAA52530@hub.org> (raw)

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));



view thread (7+ messages)  latest in thread

Message-ID: <199907221247.IAA52530@hub.org>
Permalink:  ../199907221247.IAA52530@hub.org/
Also on:    postgresql.org/message-id/199907221247.IAA52530@hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Frederic.De.Leersnijder@pandora.be
  Subject: Re: database design SQL prob.
  In-Reply-To: <199907221247.IAA52530@hub.org>
  References: <199907221247.IAA52530@hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox