Re: referential integrity (fwd)

Поиск
Список
Период
Сортировка
От Manuel Cabido
Тема Re: referential integrity (fwd)
Дата
Msg-id Pine.LNX.4.04.10001100931290.10174-100000@tinago.msuiit.edu.ph
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Vince Vielhaber
Дата:
Сообщение: Re: [ANNOUNCE] Searching http://www.postgresql.org ...
Следующее
От: Ed Loehr
Дата:
Сообщение: Re: [GENERAL] Re: referential integrity (fwd)