Oracle教育管理平台PL-SQL脚本之初期设计

来源:互联网 发布:2016淘宝报名双11入口 编辑:程序博客网 时间:2024/04/28 17:00

–(1)创建区域信息表
CREATE TABLE TbAreaInfo(
AreaId Number Not Null PRIMARY KEY,
AreaName Varchar2(50) Not Null,
ParentId Number Null,
HasChild Number Null,
AreaStauts Number Null,
UserId Number Not Null,
UserModyfiy Varchar2(30) Null,
UserDel Varchar2(30) Null,
AreaCreateTime Varchar2(20) Not Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbAreaInfo is ‘区域参数类型表(二级 市 县)’;
– Add comments to the columns
comment on column TbAreaInfo.Areaid is ‘主键标识(PK 主键标识 自增)’;
comment on column TbAreaInfo.Areaname is ‘区域名称’;
comment on column TbAreaInfo.Parentid is ‘父级Id 没有为-1’;
comment on column TbAreaInfo.Haschild is ‘子级Id 1:表示有 0:表示没有’;
comment on column TbAreaInfo.Areastauts is ‘区域状态 1:正常 0:删除’;
comment on column TbAreaInfo.Userid is ‘创建人’;
comment on column TbAreaInfo.Usermodyfiy is ‘修改人’;
comment on column TbAreaInfo.Userdel is ‘记录删除人’;
comment on column TbAreaInfo.Areacreatetime is ‘创建时间’;
comment on column TbAreaInfo.Temp1 is ‘扩展字段1’;
comment on column TbAreaInfo.Temp2 is ‘扩展字段2’;

–(2)创建政府信息表
CREATE TABLE TbGovermentInfo(
GoverId Number Not Null PRIMARY KEY,
AreaId Number Not Null,
GoverName Varchar2(50) Not Null,
GoverAddress Varchar2(50) Null,
GoverReamk Varchar2(200) Null,
GoverMgr Varchar2(50) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbGovermentInfo is ‘政府信息表’;
– Add comments to the columns
comment on column TbGovermentInfo.GoverId is ‘政府Id (PK 主键标识 自增)’;
comment on column TbGovermentInfo.AreaId is ‘所属编号 (FK 外键标识)’;
comment on column TbGovermentInfo.GoverName is ‘政府名称’;
comment on column TbGovermentInfo.GoverAddress is ‘政府所在地址(由区域+填写信息)’;
comment on column TbGovermentInfo.GoverReamk is ‘政府描述’;
comment on column TbGovermentInfo.GoverMgr is ‘管理者’;
comment on column TbGovermentInfo.Temp1 is ‘扩展字段1’;
comment on column TbGovermentInfo.Temp2 is ‘扩展字段2’;
–为政府信息表添加区域外键约束
ALTER TABLE TbGovermentInfo ADD CONSTRAINT FK_AreaId FOREIGN KEY (AreaId) REFERENCES TbAreaInfo(AreaId);

–(3)创建学校信息表
CREATE TABLE TbSchoolInfo(
SchoolId Number Not Null PRIMARY KEY,
AreaId Number Not Null,
SchoolName Varchar2(50) Not Null,
SchoolJName Varchar2(50) Not Null,
SchoolPhone Varchar2(20) Not Null,
SchooIFax Varchar2(20) Null,
SchoolAddress Varchar2(50) Not Null,
SchoolRemark Varchar2(200) Null,
SchoolMgr Number Not Null,
SchoolCreateTime Varchar2(50) Not Null,
SchoolModfiyTime Varchar2(50) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSchoolInfo is ‘学校信息表’;
– Add comments to the columns
comment on column TbSchoolInfo.SchoolId is ‘学校编号(PK 自动增长)’;
comment on column TbSchoolInfo.AreaId is ‘所属区域(FK 外键标识)’;
comment on column TbSchoolInfo.SchoolName is ‘学校名称’;
comment on column TbSchoolInfo.SchoolJName is ‘学校简称’;
comment on column TbSchoolInfo.SchoolPhone is ‘学校电话’;
comment on column TbSchoolInfo.SchooIFax is ‘学校传真’;
comment on column TbSchoolInfo.SchoolAddress is ‘学校地址’;
comment on column TbSchoolInfo.SchoolRemark is ‘学校描述’;
comment on column TbSchoolInfo.SchoolMgr is ‘学校负责人’;
comment on column TbSchoolInfo.SchoolCreateTime is ‘学校创建时间’;
comment on column TbSchoolInfo.SchoolModfiyTime is ‘学校修改时间’;
comment on column TbSchoolInfo.Temp1 is ‘扩展字段1’;
comment on column TbSchoolInfo.Temp2 is ‘扩展字段2’;
comment on column TbSchoolInfo.Temp3 is ‘扩展字段3’;
–为学校信息表添加区域外键约束
ALTER TABLE TbSchoolInfo ADD CONSTRAINT FK_S_AreaId FOREIGN KEY (AreaId) REFERENCES TbAreaInfo(AreaId);

–(4)创建学校部门中间表
CREATE TABLE TbSchoolDepart(
DepartId Number Not Null PRIMARY KEY,
SchoolId Number Not Null,
DepartNo Number Not Null,
DepartState Number Null,
DepartManager Varchar2(50) Not Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSchoolDepart is ‘创建学校部门中间表’;
– Add comments to the columns
comment on column TbSchoolDepart.DepartId is ‘主键标识(PK 自增)’;
comment on column TbSchoolDepart.SchoolId is ‘学校编号(FK 外键标识)’;
comment on column TbSchoolDepart.DepartNo is ‘部门编号(FK 外键标识)’;
comment on column TbSchoolDepart.DepartState is ‘是否删除(1:正常 0:已删除)’;
comment on column TbSchoolDepart.DepartManager is ‘部门负责人’;
comment on column TbSchoolDepart.Temp1 is ‘扩展字段1’;
comment on column TbSchoolDepart.Temp2 is ‘扩展字段2’;
–为学校部门添加学校外键约束
ALTER TABLE TbSchoolDepart ADD CONSTRAINT FK_D_SchoolId FOREIGN KEY (SchoolId) REFERENCES TbSchoolInfo(SchoolId);

–(5)创建学校部门信息表
CREATE TABLE TbSchoolDepartInfo(
DepartNo Number Not Null PRIMARY KEY,
DepartName Varchar2(50) Not Null,
DepartRemark Varchar2(50) Null,
DepartCreateTime Varchar2(50) Null,
DepartCreatePer Varchar2(50) Not Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSchoolDepartInfo is ‘学校部门信息表’;
– Add comments to the columns
comment on column TbSchoolDepartInfo.DepartNo is ‘部门编号(PK 主键标识 自增)’;
comment on column TbSchoolDepartInfo.DepartName is ‘部门名称’;
comment on column TbSchoolDepartInfo.DepartRemark is ‘部门描述’;
comment on column TbSchoolDepartInfo.DepartCreateTime is ‘部门创建时间’;
comment on column TbSchoolDepartInfo.DepartCreatePer is ‘部门创建人’;
comment on column TbSchoolDepartInfo.Temp1 is ‘扩展字段1’;
comment on column TbSchoolDepartInfo.Temp2 is ‘扩展字段2’;
–为学校部门添加部门外键约束
ALTER TABLE TbSchoolDepart ADD CONSTRAINT FK_DepartNo FOREIGN KEY (DepartNo) REFERENCES TbSchoolDepartInfo(DepartNo);

–(6)创建年级信息表
CREATE TABLE TbGradeInfo(
GradeId Number Not Null PRIMARY KEY,
SchoolId Number Not Null,
GradeName Varchar2(50) Not Null,
GradeGrateTime Varchar2(30) Not Null,
GraderGratePer Varchar2(30) Not Null,
GradeState Number Null,
GradeMgr Number Not Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbGradeInfo is ‘年级信息表’;
– Add comments to the columns
comment on column TbGradeInfo.GradeId is ‘年级编号(PK 自动增长)’;
comment on column TbGradeInfo.SchoolId is ‘学校编号(FK 外键)’;
comment on column TbGradeInfo.GradeName is ‘年级名称’;
comment on column TbGradeInfo.GradeGrateTime is ‘年级创建时间’;
comment on column TbGradeInfo.GraderGratePer is ‘年级创建人’;
comment on column TbGradeInfo.GradeState is ‘年级状态(1:正常 0:已删除)’;
comment on column TbGradeInfo.GradeMgr is ‘年级负责人’;
comment on column TbGradeInfo.Temp1 is ‘扩展字段1’;
comment on column TbGradeInfo.Temp2 is ‘扩展字段2’;
–为年级创建学校外键约束
ALTER TABLE TbGradeInfo ADD CONSTRAINT FK_G_SchoolId FOREIGN KEY (SchoolId) REFERENCES TbSchoolInfo(SchoolId);

–(7)创建班级信息表
CREATE TABLE TbClassInfo(
ClassId Number Not Null PRIMARY KEY,
GradeId Number Not Null,
ClassName Varchar2(50) Not Null,
ClassMgr Varchar2(50) Null,
ClassCreatTime Varchar2(20) Null,
ClassCreateMgr Varchar2(50) Not Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbClassInfo is ‘年级信息表’;
– Add comments to the columns
comment on column TbClassInfo.ClassId is ‘班级编号(PK 自动增长)’;
comment on column TbClassInfo.GradeId is ‘年级编号(FK 外键)’;
comment on column TbClassInfo.ClassName is ‘班级名称’;
comment on column TbClassInfo.ClassMgr is ‘班级负责人’;
comment on column TbClassInfo.ClassCreatTime is ‘班级创建时间’;
comment on column TbClassInfo.ClassCreateMgr is ‘班级创建人’;
comment on column TbClassInfo.Temp1 is ‘扩展字段1’;
comment on column TbClassInfo.Temp2 is ‘扩展字段2’;
–为班级添加年级外键约束
ALTER TABLE TbClassInfo ADD CONSTRAINT FK_GradeId FOREIGN KEY (GradeId) REFERENCES TbGradeInfo(GradeId);

–(8)创建班级职务信息表
CREATE TABLE TbClassDutyInfo(
ClassDutyId Number Not Null PRIMARY KEY,
ClassId Number Not Null,
ClassDutyName Varchar2(50) Not Null,
ClassDutyGreateTime Varchar2(50) Not Null,
ClassDutyGreatePer Varchar2(50) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null
);
– Add comments to the table
comment on table TbClassDutyInfo is ‘班级职务信息表’;
– Add comments to the columns
comment on column TbClassDutyInfo.ClassDutyId is ‘主键标识(PK 自动增长)’;
comment on column TbClassDutyInfo.ClassId is ‘班级编号(FK 外键)’;
comment on column TbClassDutyInfo.ClassDutyName is ‘职务名称’;
comment on column TbClassDutyInfo.ClassDutyGreateTime is ‘职务创建时间’;
comment on column TbClassDutyInfo.ClassDutyGreatePer is ‘职务创建人’;
comment on column TbClassDutyInfo.Temp1 is ‘扩展字段1’;
comment on column TbClassDutyInfo.Temp2 is ‘扩展字段2’;
–为职务信息表添加班级外键约束
ALTER TABLE TbClassDutyInfo ADD CONSTRAINT FK_ClassId FOREIGN KEY (ClassId) REFERENCES TbClassInfo(ClassId);

–(9)创建学生信息表
CREATE TABLE TbStudentInfo(
StudentId Number Not Null PRIMARY KEY,
StudentNo Varchar2(50) Not Null,
ClassId Number Not Null,
ClassDutyId Number Null,
TeacherId Number Null,
StudentName Varchar2(50) Not Null,
StudentImg Varchar2(200) Null,
StudentAge Number Null,
StudentBirthday Number Not Null,
StudentIdentityNo Varchar2(20) Not Null,
StudentGrade Number Not Null,
StudentPhone Varchar2(20) Null,
StudentHomePhone Varchar2(20) Null,
StudentAddress Varchar2(50) Not null,
StudentStauts Number Not null,
StudentMgr Varchar2(50) Null,
StudentMgrPhone Number Null,
StudentReamk Varchar2(200) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbStudentInfo is ‘学生信息表’;
– Add comments to the columns
comment on column TbStudentInfo.StudentId is ‘主键标识(PK 自动增长)’;
comment on column TbStudentInfo.StudentNo is ‘学员学号(GY+TZ+学员编号)生成’;
comment on column TbStudentInfo.ClassId is ‘班级编号(FK 外键)’;
comment on column TbStudentInfo.ClassDutyId is ‘学员职务(FK 外键)’;
comment on column TbStudentInfo.TeacherId is ‘所属老师(FK 外键 班主任)’;
comment on column TbStudentInfo.StudentName is ‘学员名称’;
comment on column TbStudentInfo.StudentImg is ‘学员头像’;
comment on column TbStudentInfo.StudentAge is ‘学员年龄’;
comment on column TbStudentInfo.StudentBirthday is ‘学员生日’;
comment on column TbStudentInfo.StudentIdentityNo is ‘学员身份证号’;
comment on column TbStudentInfo.StudentGrade is ‘学员等级 0: 幼儿 1:小学 2:中学3:高中 4:中专 5:大专 6:大学 7:本科 8:博士生 9:硕士生 10:研究生 11:科学家’;
comment on column TbStudentInfo.StudentPhone is ‘学员手机号码’;
comment on column TbStudentInfo.StudentHomePhone is ‘学员家庭电话’;
comment on column TbStudentInfo.StudentAddress is ‘学员家庭地址’;
comment on column TbStudentInfo.StudentStauts is ‘学员状态 1:在读 2:转校 3:离校’;
comment on column TbStudentInfo.StudentMgr is ‘学员家长名称(填写)’;
comment on column TbStudentInfo.StudentMgrPhone is ‘家长电话’;
comment on column TbStudentInfo.StudentReamk is ‘学员备注(由所属老师填写)’;
comment on column TbStudentInfo.Temp1 is ‘扩展字段1’;
comment on column TbStudentInfo.Temp2 is ‘扩展字段2’;
comment on column TbStudentInfo.Temp2 is ‘扩展字段3’;
–为学生信息表添加班级外键约束
ALTER TABLE TbStudentInfo ADD CONSTRAINT FK_S_ClassId FOREIGN KEY (ClassId) REFERENCES TbClassInfo(ClassId);
–为学生添加职务外键约束
ALTER TABLE TbStudentInfo ADD CONSTRAINT FK_ClassDutyId FOREIGN KEY (ClassDutyId) REFERENCES TbClassDutyInfo(ClassDutyId);
–为学生添加教师外键约束
ALTER TABLE TbStudentInfo ADD CONSTRAINT FK_TeacherId FOREIGN KEY (TeacherId) REFERENCES TbTeacherInfo(TeacherId);

–(10)创建教师信息表
CREATE TABLE TbTeacherInfo(
TeacherId Number Not Null PRIMARY KEY,
SchoolId Number Not Null,
DepartNo Number Not Null,
TeacherNo Varchar2(20) Not Null,
TeacherName Varchar2(50) Not Null,
TeacherJName Varchar2(50) Null,
TeacherImg Varchar2(200) Null,
TeacherAge Number Null,
TeacherGover Number Null,
TeacherImport Number Not Null,
TeacherBirthday Varchar2(20) Null,
TeacherIdCard Varchar2(20) Not Null,
TeacherZiLiao Varchar2(200) Null,
TeacherState Varchar2(1) Not Null,
TeacherAddress Varchar2(50) Null,
TeacherGrade Varchar2(1) Not Null,
TeacherEducation Varchar2(50) Not Null,
TeacherStudy Varchar2(50) Not Null,
TeacherRemark Varchar2(200) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbTeacherInfo is ‘教师信息表’;
– Add comments to the columns
comment on column TbTeacherInfo.TeacherId is ‘主键标识(PK 主键)’;
comment on column TbTeacherInfo.SchoolId is ‘学校编号(FK 外键)’;
comment on column TbTeacherInfo.DepartNo is ‘所属部门(FK 外键)’;
comment on column TbTeacherInfo.TeacherNo is ‘教师编号(UK 唯一)’;
comment on column TbTeacherInfo.TeacherName is ‘教师名称’;
comment on column TbTeacherInfo.TeacherJName is ‘教师简称’;
comment on column TbTeacherInfo.TeacherImg is ‘教师图片’;
comment on column TbTeacherInfo.TeacherAge is ‘教师年龄’;
comment on column TbTeacherInfo.TeacherGover is ‘是否党员(1:是 0:否)’;
comment on column TbTeacherInfo.TeacherImport is ‘是否重要(1:是 0:否)’;
comment on column TbTeacherInfo.TeacherBirthday is ‘教师生日’;
comment on column TbTeacherInfo.TeacherIdCard is ‘教师身份证号’;
comment on column TbTeacherInfo.TeacherZiLiao is ‘教师资料’;
comment on column TbTeacherInfo.TeacherState is ‘教师状态(1:正常 0:禁用)’;
comment on column TbTeacherInfo.TeacherAddress is ‘教师居住地址’;
comment on column TbTeacherInfo.TeacherGrade is ‘教师等级(1:校长 2:主任 3:副主任 4:普通教师 5:实习教师)’;
comment on column TbTeacherInfo.TeacherEducation is ‘教师学历(1:大专 2:大学 3:本科 4:博士 5:硕士 6:研究生 7:科学家)’;
comment on column TbTeacherInfo.TeacherStudy is ‘毕业院校’;
comment on column TbTeacherInfo.TeacherRemark is ‘教师备注’;
comment on column TbTeacherInfo.Temp1 is ‘扩展字段1’;
comment on column TbTeacherInfo.Temp2 is ‘扩展字段2’;
comment on column TbTeacherInfo.Temp2 is ‘扩展字段3’;
–为教师添加学校外键约束
ALTER TABLE TbTeacherInfo ADD CONSTRAINT FK_T_SchoolId FOREIGN KEY (SchoolId) REFERENCES TbSchoolInfo(SchoolId);
–为教师添加部门外键约束
ALTER TABLE TbTeacherInfo ADD CONSTRAINT FK_T_DepartNo FOREIGN KEY (DepartNo) REFERENCES TbSchoolDepartInfo(DepartNo);

–(11)创建用户信息表
CREATE TABLE TbSysUserInfo(
UserId Number Not Null PRIMARY KEY,
UserName Varchar2(50) Not Null,
UserPhone Varchar2(20) Not Null,
UserPassWord Varchar2(20) Not Null,
UserStatus Number Null,
UserType Number Null,
UserEmail Varchar2(50) Null,
UserEmailPassWord Varchar2(50) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSysUserInfo is ‘用户信息表’;
– Add comments to the columns
comment on column TbSysUserInfo.UserId is ‘用户编号(PK 自动增长)’;
comment on column TbSysUserInfo.UserName is ‘用户名称’;
comment on column TbSysUserInfo.UserPhone is ‘用户电话’;
comment on column TbSysUserInfo.UserPassWord is ‘用户密码’;
comment on column TbSysUserInfo.UserStatus is ‘用户状态 1:正常 0:删除’;
comment on column TbSysUserInfo.Usertype is ‘用户类型 1:学生 2:教师 3:校长 4:政府人员’;
comment on column TbSysUserInfo.UserEmail is ‘用户邮箱’;
comment on column TbSysUserInfo.UserEmailPassWord is ‘邮箱密码’;
comment on column TbSysUserInfo.Temp1 is ‘扩展字段1’;
comment on column TbSysUserInfo.Temp2 is ‘扩展字段2’;
comment on column TbSysUserInfo.Temp3 is ‘扩展字段3’;

–(12)创建权限信息表
CREATE TABLE TbSysRightInfo(
RightId Number Not Null PRIMARY KEY,
RightNo Varchar2(20) Not Null,
RightParentNo Varchar2(20) Null,
RigthName Varchar2(50) Null,
RightUrl Varchar2(200) Null,
RightType Varchar2(20) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSysRightInfo is ‘权限信息表’;
– Add comments to the columns
comment on column TbSysRightInfo.RightId is ‘主键标识(PK 自动增长)’;
comment on column TbSysRightInfo.RightNo is ‘权限编号’;
comment on column TbSysRightInfo.RightParentNo is ‘所属父级’;
comment on column TbSysRightInfo.RigthName is ‘权限名称’;
comment on column TbSysRightInfo.RightUrl is ‘权限指向地址’;
comment on column TbSysRightInfo.RightType is ‘权限类型(1:超级系统管理员2:普通管理员)’;
comment on column TbSysRightInfo.Temp1 is ‘扩展字段1’;
comment on column TbSysRightInfo.Temp2 is ‘扩展字段2’;
comment on column TbSysRightInfo.Temp3 is ‘扩展字段3’;

–(13)创建角色信息表
CREATE TABLE TbSysRoleInfo(
RoleId Number Not Null PRIMARY KEY,
RoleName Varchar2(50) Not Null,
RoleDesc Varchar2(200) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSysRoleInfo is ‘角色信息表’;
– Add comments to the columns
comment on column TbSysRoleInfo.RoleId is ‘角色编号(PK 自动增长)’;
comment on column TbSysRoleInfo.RoleName is ‘角色名称’;
comment on column TbSysRoleInfo.RoleDesc is ‘角色描述’;
comment on column TbSysRoleInfo.Temp1 is ‘扩展字段1’;
comment on column TbSysRoleInfo.Temp2 is ‘扩展字段2’;
comment on column TbSysRoleInfo.Temp3 is ‘扩展字段3’;

–(14)创建权限与角色关系表
CREATE TABLE TbSysRoleRight(
SurId Number Not Null PRIMARY KEY,
RoleId Number Not Null,
RightId Number Not Null,
SrrState Varchar2(1) Null,
Temp1 Varchar2(50) Null,
Temp2 Varchar2(50) Null,
Temp3 Varchar2(50) Null
);
– Add comments to the table
comment on table TbSysRoleRight is ‘权限与角色关系表’;
– Add comments to the columns
comment on column TbSysRoleRight.SurId is ‘主键标识(PK 自动增长)’;
comment on column TbSysRoleRight.RoleId is ‘角色编号(FK 外键)’;
comment on column TbSysRoleRight.RightId is ‘权限编号(FK 外键)’;
comment on column TbSysRoleRight.SrrState is ‘状态( 1:权限可用 2:不可用)’;
comment on column TbSysRoleRight.Temp1 is ‘扩展字段1’;
comment on column TbSysRoleRight.Temp2 is ‘扩展字段2’;
comment on column TbSysRoleRight.Temp3 is ‘扩展字段3’;

–(15)创建用户与权限信息表
CREATE TABLE TbSysUserRight(
SurId Number Not Null PRIMARY KEY,
UserId Number Not Null,
RightId Number Not Null,
SurState Varchar2(1) Null,
Temp1 Varchar2(50) Not Null,
Temp2 Varchar2(50) Not Null,
Temp3 Varchar2(50) Not Null
);
– Add comments to the table
comment on table TbSysUserRight is ‘用户与权限信息表’;
– Add comments to the columns
comment on column TbSysUserRight.SurId is ‘主键标识(PK 自动增长)’;
comment on column TbSysUserRight.UserId is ‘用户编号(FK 外键)’;
comment on column TbSysUserRight.RightId is ‘权限编号(FK 外键)’;
comment on column TbSysUserRight.SurState is ‘状态( 1:权限可用 2:不可用)’;
comment on column TbSysUserRight.Temp1 is ‘扩展字段1’;
comment on column TbSysUserRight.Temp2 is ‘扩展字段2’;
comment on column TbSysUserRight.Temp3 is ‘扩展字段3’;

–(16)创建用户与角色表
CREATE TABLE TbSysUserRole(
SurId Number Not Null PRIMARY KEY,
UserId Number Not Null,
RoleId Number Not Null,
SurState Varchar2(1) Null,
Temp1 Varchar2(50) Not Null,
Temp2 Varchar2(50) Not Null,
Temp3 Varchar2(50) Not Null
);
– Add comments to the table
comment on table TbSysUserRole is ‘用户与角色关系表’;
– Add comments to the columns
comment on column TbSysUserRole.SurId is ‘主键标识(PK 自动增长)’;
comment on column TbSysUserRole.UserId is ‘用户编号(FK 外键)’;
comment on column TbSysUserRole.RoleId is ‘角色编号(FK 外键)’;
comment on column TbSysUserRole.SurState is ‘状态( 1:权限可用 2:不可用)’;
comment on column TbSysUserRole.Temp1 is ‘扩展字段1’;
comment on column TbSysUserRole.Temp2 is ‘扩展字段2’;
comment on column TbSysUserRole.Temp3 is ‘扩展字段3’;

0 0
原创粉丝点击