optional reference

Поиск
Список
Период
Сортировка
От bill house
Тема optional reference
Дата
Msg-id 4B5BACED.4020208@bellsouth.net
обсуждение исходный текст
Ответы Re: optional reference
Список pgsql-novice
Hello,

What is a technique to reference some (but not all) rows from table a to
a row in table b?

For example:

---------------------------

DROP TABLE a;
DROP TABLE b;


CREATE TABLE a (
   column_1 character(8),
   column_2 character(2),
   column_3 character(40)
   );

INSERT INTO a VALUES
   ('20901234', '01', 'This is a the first row'),
   ('20901234', '01', 'This is the second row'),
   ('20901234', '01', 'This is the third row'),
   ('20901235', '01', 'This is the fourth row'),
   ('20901236', '01', 'This is the fifth row'),
   ('20901236', '01', 'This is the sixth row'),
   ('20901237', '01', 'This is the seventh row'),
   ('20901238', '01', 'This is the eighth row');

CREATE TABLE b (
   column_1 character(8),
   column_2 character(2),
   column_3 character(40),
   PRIMARY KEY (column_1, column_2)
   );

  INSERT INTO b VALUES
   ('20901234', '01', 'Footnote #1'),
   ('20901234', '02', 'other stuff'),
   ('20901237', '01', 'Footnote #2');

--------------------------------------

Table a rows 1, 2 & 3 should point to table b row 1.

Table a row 7 should point to table b row 3.

Any guidance would be appreciated.

Thanks,

Bill House




В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 8.5 beta manual
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: 8.5 beta manual