Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Am I right with my supertype/subtype tables creation

29240Nov 18 2001
hi there,

i have subtype/supertype relationship with a disjoint rule and
partial specialisation

---table supertype

create table gift(
gift_id number,
constraint pk_gift primary key (gift_id));


---table subtypes

create table stock(
gift_id number not null,
no_of_shares number,
curr_price number,
constraint pk_gift primary key (gift_id)),
constraint uk_gift unique (gift_id)delete cascade);

create table property(
gift_id number not null,
prop_address1 varchar2(5),
prop_address2 varchar2(15),
prop_address3 varchar2(20),
post_code varchar2(8)'
curr_prop_value number,
constraint pk_gift primary key (gift_id)),
constraint uk_gift unique (gift_id)delete cascade);


create table cash(
gift_id number not null,
amount number,
constraint pk_gift primary key (gift_id)),
constraint uk_gift unique (gift_id)delete cascade);

create table artwork(
gift_id number not null,
description varchar2(30),
artist varchar2(10),
curr_art_value number,
constraint pk_gift primary key (gift_id)),
constraint uk_gift unique (gift_id)delete cascade);


could you point out any mistakes in terms of unique constraints
and gift_id appearing as inherited by the subclasses from the
superclass. Notice gift_id is inherited by the sub classes as
primary key and not foreign key.

Are there other ways of doing this assuming i am wrong?


Much appreciation.


Ayo


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2001
Added on Nov 18 2001
2 comments
1,014 views