Consider the following relational "category" table definition and sample data
from the project:
drop table category cascade constraints;
create table category (
cname varchar2(120),
primary key cname
);
insert into category values ('Books:Biology');
insert into category values ('Books:Computers');
insert into category values ('Books:Economics');
insert into category values ('Books:Fiction');
insert into category values ('Computers:Apple:Desktops');
insert into category values ('Computers:Apple:Laptops');
insert into category values ('Computers:PCs:Desktops');
insert into category values ('Computers:PCs:Laptops');
insert into category values ('Computers:Storage:Hard Drives');
insert into category values ('Computers:Storage:Flash Drives');
insert into category values ('DVDs:Action');
insert into category values ('DVDs:Comedy');
insert into category values ('Music:Blues');
insert into category values ('Music:Jazz');
insert into category values ('Music:World');
insert into category values ('Video Games:Systems:XBox 360');
insert into category values ('Video Games:Systems:Wii');
insert into category values ('Video Games:Systems:Playstation');
insert into category values ('Video Games:Systems:Nintendo DS');
insert into category values ('Video Games:Games:XBox 360');
insert into category values ('Video Games:Games:Wii');
insert into category values ('Video Games:Games:Playstation');
insert into category values ('Video Games:Games:Nintendo DS');
Write a Java program that will extract the individual category/sub-category
from the "category" table and insert the hierarchy into the following table:
drop table hcategory cascade constraints;
create table hcategory (
supercat varchar2(120),
subcat varchar2(120),
primary key (supercat,subcat)
);
For example, the category "Video Games:Games:Nintendo DS" in the
category table will result in two rows: ('Video Games','Games') and
('Games','Nintendo DS') in the hcategory table.
You should create the hcategory table outside of the Java environment.