ORACLE - primary/foreign keys

I'm having problems with a database project i was assigned to. I am a novice when it comes to ORACLE. The project was to create a database for the circus industry, where we have Circus, Artist, Shows, Acts tables. We have:-

Table:- Acts Attrib:- Act ID (PK), ShowID(PK), Act Name, Circus Name

Table: Shows, Attrib: ShowID(PK). Shows Name, Year Began

As Act to Show would be a many to many relationship so we put an Act/Show Table

Table: Act/Show Attrib:ShowID(PK), ActID(PK)

The problem is Oracle wont let us make a refence between Acts.ShowID and Act/Show.ShowID, and a reference between Acts/Shows.ShowID and Shows.ShowID.

We do not know how to reference t foreign keys to one Primary key.

I would be very grateful if you can help me in anyway with my problem.
[832 byte] By [sam_frost] at [2007-11-18 18:13:14]
# 1 Re: ORACLE - primary/foreign keys
Hello,

There must be some problem in the statement that you are using to add the foreign keys. Oracle will allow this type or relationship (actually, this is one of the simpler relationship that Oracle will allow). The syntax should look like this:

alter table Acts
add constraint acts_show_fk foreign key (showid) references shows (showid);

alter table acts_show
add constraint acts_show_show_id_fk foreign key (showID) references shows (showID);

alter table acts_show
add constraint acts_show_act_id_fk foreign key (actID) references acts (actID);

If this is what you are typing, give the error messages that you receive.

Hope this helps!
puboiler at 2007-11-9 13:37:21 >