How to tell PostgreSQL about a relationship

Поиск
Список
Период
Сортировка
От Thomas
Тема How to tell PostgreSQL about a relationship
Дата
Msg-id 55da14450810260244nb03c79drb5bf64274fb02c97@mail.gmail.com
обсуждение исходный текст
Ответы Re: How to tell PostgreSQL about a relationship  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: How to tell PostgreSQL about a relationship  (Niklas Johansson <pgmailings@codecraft.se>)
Список pgsql-general
Hi,

I have jumped from MySQL to PostgreSQL, and I wanted to know how we
declare that a table depends on another one.

Currently I have 3 tables:

Product(id, title, price)
Item(id, product_id, order_id, quantity)
Order(id, amount, paid)

In pgAdmin I have removed a few order entries, but the items
associated to them are still here, now I have zombie items floating
around that don't belong to any order. So how do I tell PgSQL that
when I remove a given order, it should remove all associated items
also?

Best regards,

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

Предыдущее
От: "Tony Wasson"
Дата:
Сообщение: Re: a LEFT JOIN problem
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: How to tell PostgreSQL about a relationship