General ISA and Foreign Key

From: BOUCHPAN-LERUST-JUERY Lionel <bouchpan(at)ie2(dot)u-psud(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: General ISA and Foreign Key
Date: 2001-05-07 18:46:32
Message-ID: 20010507204632.A24888@pc48.ie2.u-psud.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Joseph Shraibman 2001-05-07 19:21:05 Re: Timestamp Resolution in Postgres
Previous Message David D. Kilzer 2001-05-07 18:12:27 Re: Using ORDER BY with AGGREGATE/GROUP BY in a SELECT statement