Re: referential integrity (fwd)

From: Manuel Cabido <manny(at)tinago(dot)msuiit(dot)edu(dot)ph>
To: pgsql-general(at)hub(dot)org
Subject: Re: referential integrity (fwd)
Date: 2000-01-10 01:32:01
Message-ID: Pine.LNX.4.04.10001100931290.10174-100000@tinago.msuiit.edu.ph
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sir:

I have two tables customer and order defined as follows:

create table customer (
custno integer not null,
name varchar(30),
address varchar(30),
primary key (custno));

create table order (
orderno integer not null,
custno integer,
orddate date,
amount numeric(7,2),
primary key (orderno));

create sequence 'next_cust' start 1;
create sequence 'next_ord' start 1;


My problem is how would i implement referential integrity so that
whenever i insert a new order, it should check first if the custno exist
in the customber table. Can somebody please show me an example how would i
do it in this case?

Thank you...

Manny C. Cabido
====================================
e-mail:manny(at)tinago(dot)msuiit(dot)edu(dot)ph
manny(at)sun(dot)msuiit(dot)edu(dot)ph
=====================================

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed Loehr 2000-01-10 02:53:51 Re: [GENERAL] Re: referential integrity (fwd)
Previous Message Vince Vielhaber 2000-01-10 00:28:57 Re: [ANNOUNCE] Searching http://www.postgresql.org ...