Re: referential integrity (fwd) - Mailing list pgsql-general

From Manuel Cabido
Subject Re: referential integrity (fwd)
Date
Msg-id Pine.LNX.4.04.10001100931290.10174-100000@tinago.msuiit.edu.ph
Whole thread Raw
List 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@tinago.msuiit.edu.ph
                                     manny@sun.msuiit.edu.ph
                              =====================================




pgsql-general by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: [ANNOUNCE] Searching http://www.postgresql.org ...
Next
From: Ed Loehr
Date:
Subject: Re: [GENERAL] Re: referential integrity (fwd)