General ISA and Foreign Key

Поиск
Список
Период
Сортировка
От BOUCHPAN-LERUST-JUERY Lionel
Тема General ISA and Foreign Key
Дата
Msg-id 20010507204632.A24888@pc48.ie2.u-psud.fr
обсуждение исходный текст
Ответы Re: General ISA and Foreign Key
Список pgsql-sql
I have a problem concerning an University assignment
in SQL. I am running PostgreSQL. Below part of the E/R diagram
in ASCII art.



( #VisaExploitation )     |--------          //\\        --------
|    |        //  \\        |    |
|  1    |<------------//     \\---------| copy    |
|    |             \\ from//        |    |
--------               \\  //        --------  |                \\//           |      |                       |  /\
                 (#copy ) /ISA\ ------
 
|    |
|    |
----   ----
|   |  |   |
| 2 |  | 3 |
-----  -----

1: Film
2: SpecialFilm
3: HistoricalFilm 


2 and 3 inherits from film :
In SQL I have the following tables

CREATE TABLE film(
VisaExploitation INTEGER NOT NULL,
DureeTournage INTEGER NOT NULL,
Titre VARCHAR( 50 ),

PRIMARY KEY ( VisaExploitation ) );
CREATE TABLE filmHistorique(
NbCostume INTEGER
) INHERITS ( film );

create table filmDocumentaire() INHERITS ( film );

I have a weak entity:

CREATE TABLE copie(
NumCopie INTEGER NOT NULL,
VisaExploitation INTEGER NOT NULL,
PRIMARY KEY( VisaExploitation, NumCopie ),
FOREIGN KEY( VisaExploitation ) REFERENCES film ON DELETE CASCADE );

The problem is I have to be able to have the constraint on 
both 2 and 3 and I can't figure how to implement this.

Thanking you in Advance,
Lionel



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

Предыдущее
От: "tjk@tksoft.com"
Дата:
Сообщение: Re: Re: Need help with search-and-replace
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: RI permission problem