2个主外键 约束 是否不起作用了??
来源:互联网 发布:win10网络图标无法启用 编辑:程序博客网 时间:2024/06/02 01:43
drop table grade;
drop table item;
drop table sporter;
create table sporter(
sporterid varchar2(10) primary key not null ,
name varchar2(10) not null ,
sex varchar2(6) ,
department varchar2(10) not null ,
CONSTRAINT sporter_sex_ck check(sex in('男','女'))
);
create table item(
itemid varchar2(10) primary key not null,
itemname varchar2(10) not null,
location varchar2(50) not null
);
create table grade(
sporterid varchar2(10) ,
itemid varchar2(10) not null,
mark number(1) not null,
CONSTRAINT grade_mark_ck check(mark in(6,4,2,0)) ,
CONSTRAINT sporter_grade_sporterid_fk foreign key(sporterid)
references sporter(sporterid) on delete cascade,
CONSTRAINT sporter_item_itemid_fk foreign key(itemid)
references item(itemid) ON DELETE CASCADE
);
-- 测试数据 sporter (运动员)
insert into sporter(sporterid,name,sex,department) values('1001','李明','男','计算机系');
insert into sporter(sporterid,name,sex,department) values('1002','张山','男','数学系');
insert into sporter(sporterid,name,sex,department) values('1003','李四','男','计算机系');
insert into sporter(sporterid,name,sex,department) values('1004','王二','男','物理系');
insert into sporter(sporterid,name,sex,department) values('1005','李娜','女','心理系');
insert into sporter(sporterid,name,sex,department) values('1006','孙俪','女','数学系');
-- 测试数据 item (项目)
insert into item(itemid,itemname,location) values('x001','男子5000米','一操场');
insert into item(itemid,itemname,location) values('x002','男子标枪','一操场');
insert into item(itemid,itemname,location) values('x003','男子跳远','二操场');
insert into item(itemid,itemname,location) values('x004','女子跳高','二操场');
insert into item(itemid,itemname,location) values('x005','女子3000米','三操场');
-- 测试数据 grade (积分)
insert into grade(sporterid,itemid,mark) values('1001','x001',6);
insert into grade(sporterid,itemid,mark) values('1002','x001',4);
insert into grade(sporterid,itemid,mark) values('1003','x001',2);
insert into grade(sporterid,itemid,mark) values('1004','x001',0);
insert into grade(sporterid,itemid,mark) values('1001','x003',4);
insert into grade(sporterid,itemid,mark) values('1002','x003',6);
insert into grade(sporterid,itemid,mark) values('1004','x003',2);
insert into grade(sporterid,itemid,mark) values('1005','x004',6);
insert into grade(sporterid,itemid,mark) values('1006','x004',4);
2个主外键 约束 是否不起作用了??
- 2个主外键 约束 是否不起作用了??
- 约束 对 tableheadview 不起作用b
- eclipse debug不起作用了
- javascript不起作用了
- layout_width,laiyout_height不起作用了
- 配置了系统环境变量不起作用
- VS2005下BoundField的DataFormatString不起作用了?
- Remove控件后Dispose就不起作用了
- 为什么Mysql的外键不起作用了?
- toolbar的背景色竟然不起作用了
- eclipse 代码规范快捷键不起作用了
- sencha touch 项目的样式不起作用了
- Android中startActivityForResult竟然不起作用了....
- iPhone,提醒事项,设置了,为什么不起作用?
- EL表达式不起作用2。
- onItemClickListener不起作用解决办法2
- maxLength属性不起作用了?可能是与InputFilter冲突了
- 如何判断数据库中某张表是否存在约束
- Question 26: Which of the following options describe the expected overhead for a class that has 5 virtual functions?
- 页面报错的代号意义
- 程序打包之SetupFactory
- 关于JAVA中变量的初始化及类属性的默认值问题
- [Jakarta Commons] 使用LRUMap
- 2个主外键 约束 是否不起作用了??
- CSS+DIV CSS布局口诀
- C, C++和C#中的数值类型及其宽度
- Question 27: Which of the following reasons describe why a destructor cannot throw an exception in C++?
- CSS+DIV 网站优化(seo)
- CSS+DIV 推荐的 CSS 规范书写顺序
- atl中常见的模板使用手法
- 单例模式的5种实现方式
- DIV+CSS 请不要再忽悠人了