人力资源管理数据库设计与实现.doc_第1页
人力资源管理数据库设计与实现.doc_第2页
人力资源管理数据库设计与实现.doc_第3页
人力资源管理数据库设计与实现.doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

模块一:Create database staff2create table information( yid int identity(1,1) primary key, info_name char(20) , info_sex char(2), info_card char(20), info_state char(25), info_adress char(50),);select *from information create table wage( yid tinyint identity(1,1) primary key, wage_name_id int not null, wage_totle float(20), /*本月总工资*/ wage_pay float (15), /*本月已发工资*/ wage_pay_date char(15) not null );select *from wageCreate table state( state_id tinyint identity(1,1) primary key, state_name varchar(16) UNIQUE); select *from state模块二 /*查询员工基本信息的视图*/Create view information_view(info_id,info_name,info_sex,info_card,info_state,info_adress)asselect *from information/*查询员工工资的视图*/create view wage(wage_id,wage_name,wage_totle,wage_pay,wage_pay_date)asselect *from wage/*查询员工等级表*/create view state(state_id,state_name)asselect *from state/*建立索引*/create unique index info_nameindex on information(info_name)exec sp_helpindex information模块四:/*建立触发器*/当删除information中某项基本信息,触发wage表,删除相应的记录create trigger information_deleteon informationfor deleteasdeclare id intselect id = id from deleteddelete wagewhere id = id/*创建各个存储过程*/*在information插入一条新记录*/create procedure info_pro2(id int,name char(20),info_sex char(2),info_card char(20),info_state char(25),info_adress char(50)asinsertinto informationvalues (id,name,info_sex,info_card,info_state,info_adress)执行:exec info_pro2 id=20,name=萍媛,info_sex=女,info_card=536819900221,info_state=经理,info_adress=江西/*创建一个查询存储过程*/create procedure info_prodasselect *from informationexec info_prod/*创建一个删除存储过程*/create procedure info_prod3asselect *from information模块五:select * from wage /*创建一表格,用于实现工资差记录*/create table s_wage(wage_name_id char(20), s_wage money)/*实现工资差的记录*/create procedure my_pro_swageas begin declare id char(20)declare mycursor cursor for select wage_name_id from wageopen mycursorfetch next from mycursor into idwhile fetch_status=0 begin declare wage_totle money,wage_pay money select wage_totle=wage_totle,wage_pay=wage_pay from wage where wage_name_id=id insert into s_wage values(id,wage_totle-wage_pay) fetch next from mycursor into id end close mycursor deallocate mycursorend /*执行*/exec my_pro_swageselect * from wageselect *from information /*建立一个触发器,用于满足当infomation改变时wage有所记录*/create trigger my_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论