alter table pets_like_boys drop constraint pets_like;
alter table boys_like_girls drop constraint boys_like;
alter table girls_like_pets drop constraint girls_like;
drop table pets_like_boys;
drop table boys_like_girls;
drop table girls_like_pets;
create table pets_like_boys (pets_name varchar(32), boys_name varchar(32),primary key (pets_name)) ;
create table boys_like_girls (boys_name varchar(32), girls_name varchar(32),primary key (boys_name)) ;
create table girls_like_pets (girls_name varchar(32), pets_name varchar(32),primary key (girls_name)) ;
insert into pets_like_boys values('fluffy', 'sam');
insert into pets_like_boys values('rover', 'bob');
insert into pets_like_boys values('skippy', 'joe');
insert into boys_like_girls values('bob','jill');
insert into boys_like_girls values('sam','betty');
insert into boys_like_girls values('joe','sue');
insert into boys_like_girls values('george','jill');
insert into girls_like_pets values('sue','fluffy');
insert into girls_like_pets values('jill','skippy');
insert into girls_like_pets values('betty','rover');
alter table pets_like_boys add constraint pets_like foreign key (boys_name) references boys_like_girls(boys_name) on delete cascade;
alter table boys_like_girls add constraint boys_like foreign key (girls_name) references girls_like_pets(girls_name) on delete cascade;
alter table girls_like_pets add constraint girls_like foreign key (pets_name) references pets_like_boys(pets_name) on delete cascade;
select * from pets_like_boys;
select * from boys_like_girls;
select * from girls_like_pets;
delete from boys_like_girls where boys_name = 'bob';
select * from pets_like_boys;
select * from boys_like_girls;
select * from girls_like_pets;
landonmkelsey
-1
Newbie Poster
Recommended Answers
Jump to PostWhy you have posted this code here ?
Do you have a question ?
Jump to PostIf you know something and want to show your knowledge then please do not post those here as questions. Better post those as an article ,that will really help the new members.
Jump to PostIf you know something and want to show your knowledge then please do not post those here as questions. Better post those as an article ,that will really help the new members.
In my opinion, It doesn't matter if it is a forum thread or an article to share knowledge. …
Jump to PostDefinitely there is no potential danger, but as time pass this thread will go down the memory line. Once it goes pas t the 2nd page i don't think anyone will ever open it unless someone runs a search with specific key words. So my idea was if it is …
Jump to PostHmm.. Interesting.. What I would have liked to know was the result.. Unfortunately, I don't have oracle installed anywhere [office/home], so I can't check these queries. What happens if we run the query ? Thanks.
All 17 Replies
debasisdas
580
Posting Genius
Featured Poster
landonmkelsey
-1
Newbie Poster
debasisdas
580
Posting Genius
Featured Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
debasisdas
580
Posting Genius
Featured Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
landonmkelsey
-1
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
landonmkelsey
-1
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
landonmkelsey
-1
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
landonmkelsey
-1
Newbie Poster
landonmkelsey
-1
Newbie Poster
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
landonmkelsey
-1
Newbie Poster
debasisdas
580
Posting Genius
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.