Re: JOINING TWO TABLES

Поиск
Список
Период
Сортировка
Искать
От
Richard Broersma Jr
Тема
Re: JOINING TWO TABLES
Дата
Msg-id
328187.8244.qm@web31813.mail.mud.yahoo.com
Ответ на
JOINING TWO TABLES (vamseelist@gmail.com)
Список
Дерево обсуждения
JOINING TWO TABLES vamseelist@gmail.com
Re: JOINING TWO TABLES Richard Broersma Jr <rabroersma@yahoo.com>

--- vamseelist@gmail.com wrote:
> I mean d,e got 1 and 2 in mgr table.
> d,e got 4,5 in new table.
> 
> I would like to replace 1 1 2 with 4 4 5.
> 
> I would like to modify above table as

I would modify your manager and employees tables to look like:


CREATE TABLE Employees (
  emp_id SERIAL PRIMARY KEY,
  name text,
  mgr_id INTEGER);

CREATE TABLE Managers (
  mgr_id INTEGER PRIMARY KEY REFERENCES Employees( emp_id ));

   ALTER TABLE Employees 
ADD CONSTRAINT managers_of_employees
   FOREIGN KEY ( mgr_id )
    REFERENCES Managers( mgr_id );

Regards,
Richard Broersma Jr.
В списке pgsql-novice по дате отправления
От: vamseelist@gmail.com
Дата:
Сообщение: JOINING TWO TABLES
От: Angelica Garcia
Дата:
Сообщение: tree-like structures in pgsql
FAQ