Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

5.

1 Definitely if the relation has a foreign key I am going to use ON DELETE CASCADE clause in the
child table. It is more appropriate to use ON DELETE CASCADE clause because if we don’t want to
keep data in the parent table then there is no use of keeping the track of parent table user data in
the child table.

1. For the relation of the client and clientcatagorie table.

Deleting a client from CLIENT table also deletes all client Categorise belonging to that Client from the
CLIENTCATEGORY table.

CREATE TABLE CLIENT

(ClientID NUMBER (45) CONSTRAINT

CLIENT_ClientID_PK PRIMARY KEY,

...

CREATE TABLE CLIENTCATAGORIE

(...

ClientID NUMBER (45) CONSTRAINT CLIENTCATAGORIE _ClientID_FK

REFERENCES CLIENT (ClientID) ON DELETE CASCADE,

2. For the relation of the client table and clientsuburb table.

Deleting a client from CLIENT table also deletes all client suburb belonging to that Client from the
CLIENTSUBURB table.

CREATE TABLE CLIENT

(ClientID NUMBER (400) CONSTRAINT

CLIENT_ClientID_PK PRIMARY KEY,

...

CREATE TABLE CLIENTSUBURB

(...

ClientID NUMBER (400) CONSTRAINT CLIENTSUBURB_ClientID_FK

REFERENCES CLIENT (ClientID) ON DELETE CASCADE,


3. For the re-lation of the SUBURB table and CLIENTSUBURB table I am going to use ON DELETE
RESTRICT clause in the child table.

The suburb record in SUBURB table can only be deleted if there are no orders for that Suburb in
CLIENTSUBURB table.

CREATE TABLE SUBURB

(SuburbID NUMBER (350) CONSTRAINT

SUBURB_SuburbID_PK PRIMARY KEY,

...

CREATE TABLE CLIENTSUBURB

(...

SuburbID NUMBER (350) CONSTRAINT CLIENTSUBURB_SuburbID_FK

REFERENCES CLIENT (ClientID) ON DELETE RESTRICT,

4. For the relation of the SUBURB table and CLIENTSUBURB table I am going to use ON DELETE
RESTRICT clause in the child table.

The category record in CATEGORY table can only be deleted if there are no orders for that category
in CLIENTCATAGORY table.

CREATE TABLE CATEGORY

(CategoryID NUMBER (450) CONSTRAINT

CATEGORY_CategoryID_PK PRIMARY KEY,

...

CREATE TABLE CLIENTCATAGORIE

(...

CategoryID NUMBER (450) CONSTRAINT CLIENTCATAGORIE _CategoryID_FK

REFERENCES CLIENT (ClientID) ON DELETE RESTRICT,


5. For the relation of the PROPERTY table and OFFER table I am going to use ON DELETE RESTRICT
clause in the child table.

The Property record in PORPERTY table can only be deleted if there are no Offers for that Property in
OFFER table.

CREATE TABLE PROPERTY

(PorpertyID NUMBER (750) CONSTRAINT

PROPERTY_PropertyID_PK PRIMARY KEY,

...

CREATE TABLE OFEER

(...

PropertyID NUMBER (750) CONSTRAINT OFFER _CategoryID_FK

REFERENCES CLIENT (ClientID) ON DELETE RESTRICT,


DATA VOLUME MAP

48 CLIENT 4 5 CLIENT
CATEGORY CLIENT
CATEGORY SUBURB
100 1200
4800 6000
75

OFFER SUBURB
2400 80

2
PRICE
RANGE
40

1
PROPERTY
1200

You might also like