人事工资管理

来源:互联网 发布:域名la 编辑:程序博客网 时间:2024/04/19 19:10

use master
go
-----1.判断数据库是否存在
if exists(select * from sysdatabases where name='access')
drop database access
go
create database access
go
use access
go

--------------------------------建表
----------------------------员工信息表
if exists(select * from sysobjects where type='U' and name='employee')
drop table employee
go
/*employee表 :
字段名称  类型 说明
employeeId  文本 职工编号,主键
name   文本 姓名
cardNumber  文本 身份证号
nation   文本 民族
sex    文本 性别
birthday  文本 生日
graduateSchool 文本 毕业学校
schoolRecord 文本 学历
department  文本 部门
positionName 文本 职称
telephone  文本 电话
email   文本 电子邮件
editTime  文本 编辑时间
Memo   备注 附加信息

*/
create table employee
 (
 employeeId varchar(20) primary key not null, --职工编号,主键
 name varchar(20) not null, --姓名
 cardNumber varchar(20) not null, --身份证号
 nation varchar(20) not null,--民族
 sex varchar(2) not null,--性别
 birthday varchar(10) not null,--生日
 graduateSchool varchar(20) not null,--毕业学校
 schoolRecord varchar(30) not null,--学历
 department varchar(20) not null,--部门
 positionName varchar(20) not null,--职称
 telephone varchar(20) not null,--电话
 email varchar(20) not null,--电子邮件
 editTime varchar(20) not null,--编辑时间
 Memo varchar(50) not null,--附加信息 
)
go
insert into employee(employeeId,name,cardNumber,nation,sex,birthday,
graduateSchool,schoolRecord,department,positionName,telephone,email,editTime,Memo)
values()
go


----------------------------工资信息表
if exists(select * from sysobjects where type='U' and name='salary')
drop table salary
go
/*salary表 :
字段名称  类型  说明
salaryId  自动编号 主键,工资编号
employeeId  文本  员工编号
employeeName 文本  员工姓名
year   整型  工资发放年
month   整型  工资发放月
basicWage  单精度型 基本工资
overtimeWage 单精度型 加工工资
trafficWage  单精度型 交通补助
totalWage  单精度型 总工资
kaoqinReduce 单精度型 考勤扣除
secureReduce 单精度型 保险扣除
taxReduce  单精度型 税收扣除
totalReduce  单精度型 总扣除
realWage  单精度型 实际工资
editTime  文本  编辑时间
memo   备注  附加信息
*/
create table salary
 (
 salaryId int identity(1000001,1)  primary key not null,--主键,工资编号
 employeeId varchar(20) not null, --员工编号
 employeeName varchar(20) not null,--员工姓名
 [year] int not null,--工资发放年
 [month] int not null,--工资发放月
 basicWage float not null, --单精度型,基本工资
 overtimeWage float not null,--单精度型,加工工资
 trafficWage float not null,--单精度型,交通补助
 totalWage float not null,--单精度型,总工资
 kaoqinReduce float not null,--单精度型,考勤扣除
 secureReduce float not null,--单精度型,保险扣除
 taxReduce float not null,--单精度型,税收扣除
 totalReduce float not null,--单精度型,总扣除
 realWage float not null,--单精度型,实际工资
 editTime varchar(20) not null,--编辑时间
 Memo varchar(50) not null,--附加信息 
)
go
insert into salary(salaryId,employeeId,employeeName,year,month,basicWage,overtimeWage,trafficWage,
totalWage,kaoqinReduce,secureReduce,taxReduce,totalReduce,realWage,editTime,Memo)
values()
go

 


--------------------------------------------请假信息表
if exists(select * from sysobjects where type='U' and name='leave')
drop table leave
go
/*leave表 :
字段名称  类型  说明
leaveId   自动编号 主键,假条编号
employeeId  文本  员工编号
employeeName 文本  员工姓名
startTime  文本  请假开始时间
day    文本  请假天数
reason   文本  请假原因
approvePerson 文本  批准人
editTime  文本  编辑时间
Memo   备注  附加信息
*/
create table leave
 (
 leaveId int identity(1001,1)  primary key not null,--主键,假条编号
 employeeId varchar(20) not null, --员工编号
 employeeName varchar(20) not null,--员工姓名
 startTime varchar(20) not null,--请假开始时间
 [day] varchar(20) not null,--请假天数
 reason varchar(50) not null,--请假原因
 approvePerson varchar(20) not null,--批准人
 editTime varchar(20) not null,--编辑时间
 Memo varchar(50) not null,--附加信息 
)
go
insert into leave(leaveId,employeeId,employeeName,startTime,day,reason,
approvePerson,editTime,Memo)
values()
go