sql-table

上传人:子 文档编号:42914371 上传时间:2018-06-04 格式:DOC 页数:6 大小:14.77KB
返回 下载 相关 举报
sql-table_第1页
第1页 / 共6页
sql-table_第2页
第2页 / 共6页
sql-table_第3页
第3页 / 共6页
sql-table_第4页
第4页 / 共6页
sql-table_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《sql-table》由会员分享,可在线阅读,更多相关《sql-table(6页珍藏版)》请在金锄头文库上搜索。

1、SQL-tableSQL-tableuse 人事管理系统-建立表create table 员工表(员工编号 int identity(1,1) not null primary key,员工姓名char(50) not null,员工登录名char(20) not null,constraint FK_员工登录名 check (员工登录名!=员工姓名 and 员工登录名 like a-za-za-za-za-za-za-za-za-za-za-za-za-za-za-za-za-za-za-z),员工登录密码binary(20),员工电子邮件char(50) not null,员工所属部门编号

2、int,员工基本薪资int default 0,员工职位名称char(50) ,员工电话char(50),员工报到日期datetime,员工自我介绍char(200) default ,员工剩余假期int,员工的级别int,员工照片image)alter table 员工表 add constraint FK_员工所属部门编号 foreign key(员工所属部门编号) references 部门表(部门编号)alter table 员工表 add constraint FK_员工的级别 foreign key(员工的级别) references 员工级别表(员工的级别)-似乎没有员工级别表,

3、自己建立的。create table 员工级别表(员工的级别int not null primary key -假定有三级吧,1 为人员,2 为经理,3 为老总)create table 部门表(部门编号int identity(1,1) not null primary key,部门名称char(10),部门描述char(50),部门经理编号int)alter table 部门表 add constraint fk_部门经理编号 foreign key(部门经理编号) references 员工表(员工编号)create table 员工薪资表(薪资编号int identity(1,1 )n

4、ot null primary key,员工编号int not null,薪资发放时间datetime not null,加班薪资int default 0,缺勤扣除int default 0,其他薪资int default 0)alter table 员工薪资表 add constraint fk_员工编号 foreign key(员工编号) references 员工表(员工编号)create table 员工考勤表(考勤编号int identity(1,1) not null primary key,员工编号int not null,到达时间datetime,记录者编号int,check

5、 (记录者编号!=员工编号),考勤类型char(4) not null, check (考勤类型 in(缺勤, 迟到, 早退),请求重新审核int,日期datetime not null)alter table 员工考勤表 add constraint fk_员工编号_员工考勤表 foreign key(员工编号) references 员工表(员工编号)alter table 员工考勤表 add constraint fk_记录者编号 foreign key(记录者编号) references 员工表(员工编号)create table 员工请假表(请假申请编号int identity(1,

6、1) not null primary key,员工编号int not null,提交时间datetime not null,开始时间datetime not null,结束时间datetime not null,check(结束时间开始时间),理由说明char(100),类型编号int,小时数float not null,申请状态char(20),check(申请状态 in (已提交,已取消,已否决,已批准),审核者编号int,拒绝申请的理由 char(100)alter table 员工请假表 add foreign key(员工编号) references 员工表(员工编号)alter

7、table 员工请假表 add foreign key(审核者编号) references 员工表(员工编号)create table 员工加班表(加班申请编号int not null primary key,员工编号int not null,审核者编号int,提交时间datetime not null,开始时间datetime not null,结束时间datetime not null,加班理由char(100) not null,申请状态char(10) not null,check(申请状态 in (已提交,已取消,已否决,已批准),加班类型int,拒绝申请的理由 char(100),

8、小时数int)alter table 员工加班表 add foreign key(加班类型) references 加班类型表(加班类型)alter table 员工加班表 add foreign key(员工编号) references 员工表(员工编号)create table 员工业绩评定表(业绩评定编号int identity(1,1) not null primary key,员工编号int not null,审核者编号int,提交时间datetime not null,年份int not null,季度int not null,状态int,check(状态 in(0,1),最后编辑

9、时间datetime,自我评分int,审核者评分int,自我评价char(200) default ,审核者评价char(200) default )alter table 员工业绩评定表 add foreign key(员工编号) references 员工表(员工编号)create table 系统配置表(系统配置编号 int not null,系统配置类型char(10),系统配置名称char(50) not null,系统配置值char(50)create table 系统事件表(事件编号int identity(1,1) not null primary key,事件发生时间date

10、time not null,事件描述char(100) not null)create table 业绩评定状态表(业绩评定类型 int not null,业绩评定名称char(10) not null)create table 加班类型表(加班类型int not null unique,加班类型的名称描述char(10) not null,check(加班类型的名称描述 in(折算成年假,折算成津贴)create table 假期表(假期编号int identity(1,1) not null primary key,假期具体时间datetime not null,假期名称char(50) not null,是否为国定假期 bit not null,check(是否为国定假期 in(0,1)create table 业绩评定子项目表(业绩评定子项目编号int not null primary key,业绩评定编号int not null unique,项目内容char(100) not null,自我评分int,审核者评分int)alter table 业绩评定子项目表 add foreign key(业绩评定编号) references 员工业绩评定表(业绩评定编号)

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号