一:创建表和插入数据
create table menu
(
menu_id varchar2(10) not null primary key, --菜单编码
menu_name varchar2(50) not null -- 菜单名称
)
insert into menu(menu_id,menu_name) values('001' ,'编程设计');
insert into menu(menu_id,menu_name) values('002' ,'搜索引擎');
insert into menu(menu_id,menu_name) values('003' ,'财经股市');
insert into menu(menu_id,menu_name) values('004' ,'新闻报刊');
create table menu_item
(
menu_id varchar2(10) not null, --菜单编码
item_id varchar2(10) not null, --子菜单编码
item_name varchar2(50) not null, --子菜单名称
url varchar2(100) not null, --链接地址
constraint p_coll primary key(menu_id,item_id),
constraint p_out foreign key(menu_id) references menu(menu_id)
)
insert into menu_item(menu_id,item_id,item_name,url) values('001' ,'001' ,'开发者俱乐部' ,'http://www.dev-club.com/');
insert into menu_item(menu_id,item_id,item_name,url) values('001' ,'002' ,'程序员大本营' ,'http://www.csdn.net/');
insert into menu_item(menu_id,item_id,item_name,url) values('001' ,'003' ,'JAVA官方站(英文)' ,'http://www.sun.com/');
insert into menu_item(menu_id,item_id,item_name,url) values('002' ,'001' ,'Google搜索' ,'http://www.google.com/');
insert into menu_item(menu_id,item_id,item_name,url) values('002' ,'002' ,'雅虎中国' ,'http://cn.yahoo.com/');
insert into menu_item(menu_id,item_id,item_name,url) values('002' ,'003' ,'百度中文' ,'http://www.baidu.com/');
insert into menu_item(menu_id,item_id,item_name,url) values('003' ,'001' ,'金融界' ,'http://www.jrj.com.cn/default.htm');
insert into menu_item(menu_id,item_id,item_name,url) values('003' ,'002' ,'和讯财经' ,'http://www.hexun.com');
insert into menu_item(menu_id,item_id,item_name,url) values('003' ,'003' ,'证券之星' ,'http://www.stockstar.com/home.htm');
insert into menu_item(menu_id,item_id,item_name,url) values('004' ,'001' ,'凤凰网' ,'http://www.phoenixtv.com/');
insert into menu_item(menu_id,item_id,item_name,url) values('004' ,'002' ,'新浪新闻' ,'http://www.sina.com.cn/');
insert into menu_item(menu_id,item_id,item_name,url) values('004' ,'003' ,'新华网' ,'http://www.xinhuanet.com/');
|
|