end
go
grant select on xueshen to public
go
execute sp_primarykey banji,bj_id
execute sp_primarykey kecheng,kc_id
execute sp_primarykey jiaoshi, js_id
execute sp_primarykey xi, xi_id
execute sp_primarykey zhuanye, zy_id
execute sp_primarykey jskc, kc_id,js_id
execute sp_primarykey jiaocai,jc_id
execute sp_primarykey xskc, kc_id , xuehao
execute sp_primarykey xueshen,xuehao
go
execute sp_foreignkey jiaoshi, xi , xi_id
execute sp_foreignkey jskc , jiaoshi , js_id
execute sp_foreignkey jskc , kecheng , kc_id
execute sp_foreignkey jskc , banji , bj_id
execute sp_foreignkey jskc , jiaocai , jc_id
execute sp_foreignkey xskc,kecheng,kc_id
execute sp_foreignkey xueshen,banji,bj_id
execute sp_foreignkey xueshen, zhuanye , zy_id
go
create unique clustered index pubind
on banji (bj_id)
go
create unique clustered index pubind
on kecheng (kc_id)
go
create unique clustered index pubind
on jiaoshi (js_id)
go
create unique clustered index pubind
on xi (xi_id)
go
create unique clustered index pubind
on zhuanye (zy_id)
go
create unique clustered index pubind
on jskc (js_id,kc_id)
go
create unique clustered index pubind
on jiaocai (jc_id)
go
create unique clustered index pubind
on xskc (kc_id,xuehao)
go
create unique clustered index pubind
on xueshen (xuehao)
go
insert banji
values('0101', '应用1', 'mai','123456')
go
insert banji
values('0102', '应用2', 'mm','654321')
go
insert banji
values('0103', '应用3', 'haha','456789')
go
insert banji
values('0104', '应用4', 'hh','987654')
go
insert kecheng
values('0201','c++')
go
insert kecheng
values('0202','sybase')
go
insert kecheng
values('0203','delphi')
go
insert kecheng
values('0204','foxpro')
go
insert jiaoshi
values('0301','m1','mm1','0401','0501','b')
go
insert jiaoshi
values('0302','y1','yy1','0402','0502','g')
go
insert jiaoshi
values('0303','k1','kk1','0403','0503','g')
go
insert jiaoshi
values('0304','g1','gg1','0404','0504','b')
go
insert xi
values('0401','q1','qq1','qqq1','124555')
go
insert xi
values('0402','t1','tt1','ttt1','4511050')
go
insert xi
values('0403','r1','rr1','rrr1','4987950')
go
insert xi
values('0404','u1','uu1','uuu1','023150')
go
insert zhuanye
values('0501','z1','zz1','1222695')
go
insert zhuanye
values('0502','o1','oo1','9865695')
go
insert zhuanye
values('0503','p1','pp1','3655695')
go
insert zhuanye
values('0504','l1','ll1','56855695')
go
insert jskc
values('0301','0201','0101','0601',56,4,'123a',3)
go
insert jskc
values('0302','0202','0102','0602',51,3,'123b',2)
go
insert jskc
values('0303','0203','0103','0603',61,5,'123c',3)
go
insert jskc
values('0304','0204','0104','0604',48,3,'123d',5)
go
insert jiaocai
values('0601','sa')
go
insert jiaocai
values('0602','sb')
go
insert jiaocai
values('0603','sc')
go
insert jiaocai
values('0604','sd')
go
insert xskc
values('0101','0201','01161101',75)
go
insert xskc
values('0101','0201','01161105',65)
go
insert xskc
values('0101','0201','01161106',78)
go
insert xskc
values('0101','0201','01161107',98)
go
insert xskc
values('0102','0202','01161102',85)
go
insert xskc
values('0102','0202','01161108',75)
go
insert xskc
values('0102','0202','01161109',79)
go
insert xskc
values('0102','0202','01161110',86)
go
insert xskc
values('0103'