- 要求的约束条件有:
- 主键是学号;入学日期必须大于出生日期;总分必须在0到700之间;学号和姓名不能为空
- create table student (
- sid number not null primary key,
- name nvarchar2(10) not null,
- birthday date,
- sdate date,
- address nvarchar2(20),
- mark number,
- constraint ck_sdate check(sdate>birthday),
- constraint ck_mark check(mark>=0 and mark<=700))tablespace users;
- insert into student values(1001,'张三','1-1月-1981','1-1月-1999','上海',600);
- 用OEM再创建以上表student2,添加约束,并在数据输入窗口输入以下记录:
- 表字段名(英文部分)及部分数据如下:
- sid(学号)name(姓名)birthday(出生日期)sdate(入学日期)address(家庭地址 ) mark(入学总分)
- 1001 张三名 1981-1-1 1999-1-1 张三名的家庭地址 600
- 1002 李三名 1982-2-2 2000-1-1 李三名的家庭地址 620
- 1003 张四名 1983-3-3 2001-1-1 张四名的家庭地址 580
- 1004 李四名 1984-4-4 2002-1-1 李四名的家庭地址 592
来源: http://www.phpxs.com/code/1008544/