SQL Language (MOSC)

MOSC Banner

Question on Primary and Foriegn key constraints (Composite) ...

edited Apr 5, 2012 3:29AM in SQL Language (MOSC) 6 commentsAnswered

We are working on Oracle 11g. We have 3 Tables A,B and C. C has an identifying foreign relationship with A  and C has a non-identifying foreign relationship with B. A does not have any relationship to B. We have modeled that in Case tool and have the following scripts for table definition.

 

/* Create A*/

CREATE TABLE A

    (

     CLIENT_ID NUMBER (10)  NOT NULL ,

     ELEMENT_ID NUMBER (10)  NOT NULL ,

     A_DESC VARCHAR2 (10) ,

     A_NUMBER NUMBER (10)

    )

;

ALTER TABLE A

    ADD CONSTRAINT A_PK PRIMARY KEY ( CLIENT_ID, ELEMENT_ID) ;

 

/* Create B*/

CREATE TABLE B

    (

     CLIENT_ID NUMBER (10)  NOT NULL ,

     CALENDAR_ID NUMBER (10)  NOT NULL ,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center