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


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to