ylbtech-dbs:ylbtech-7,welfareSystem(福利发放系统)

-- =============================================
-- DatabaseName: WelfareSystem
-- remark: 福利发放系统
-- author: YuanBo
-- date: 09:51 2013-03-26
-- =============================================

1.A,数据库关系图(Database Diagram) 返回顶部
1.B,数据库设计脚本(Database Design Script)返回顶部

1.B.1,welfareSystem.sql

use master
go
-- =============================================
-- DatabaseName: WelfareSystem
-- remark: 福利发放系统
-- author: YuanBo
-- date: 09:51 2013-03-26
-- =============================================
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'WelfareSystem')
DROP DATABASE WelfareSystem
GO CREATE DATABASE WelfareSystem
GO
use WelfareSystem go
-- =============================================
-- ylb:1,部门表
-- =============================================
create table Department
(
departmentId int primary key identity(100,1), --编号【PK】
departmentName varchar(100) --部门名称
) go
-- =============================================
-- ylb:2,员工表
-- =============================================
create table Employee
(
employeeId int primary key identity(1001,1), --编号【PK】
[id] char(18), --身份证号
username varchar(40), --姓名
sex char(6) check(sex='男'or sex='女'),--性别
cardNo char(22), --银行卡号
hireDate datetime, --受雇日期
departmentId int, --部门编号
state char(8) --员工性质(正式内,正式入,中心版)
)
--select employeeId,[id],username,sex,cardNo,hireDate,departmentId,state,ToRegularDate from Employee go
-- =============================================
-- ylb:2.2,员工子女表
-- =============================================
create table Children
(
childrenId int primary key identity(1001,1), --编号【PK】
[id] char(18), --身份证号
username varchar(20), --姓名
sex char(6) check(sex='男'or sex='女'),--性别
birthdate datetime, --出生日期
multipleBirths varchar(20), --多胞胎 单保胎,多保胎
howManyChild varchar(20), --第一胎,第二胎,第三胎...
employeeId int --员工编号
)
go
-- =============================================
-- ylb:3.1,项目表
-- =============================================
create table Project
(
projectId int primary key identity(100,1), --编号【PK】
projectName varchar(100), --项目名称
salary money, --福利金额
type char(20) --发放形式(一次性发放,多次性发放)
)
--go
---- =============================================
---- ylb:3.2,项目年度发放表
---- =============================================
--create table ProjectAnnualIssue
--(
--projectAnnualIssueId int primary key identity(1,1), --编号【PK】
--pubdate datetime, --发放日期
--projectId int --项目编号【FK】
--)
go
-- =============================================
-- ylb:3.2,项目年度发放表
-- =============================================
create table ProjectAnnualIssue
(
projectAnnualIssueId int primary key identity(1,1), --编号【PK】
pubdate datetime, --发放日期
projectId int, --项目编号【FK】
projectName varchar(100), --项目名称
total money, --发放金额
baseId int default(-1), -- 上级编号 -1:代表无上级
remark varchar(100), --摘要,即描述
number int --发放人数
) go
-- =============================================
-- ylb:4,金额发放表
-- =============================================
create table AmountIssuing
(
amountIssuingId int primary key identity(1,1), --编号【PK】
employeeId int, --员工编号【FK】
departmentId int, --部门编号【FK】
departmentName varchar(20), --部门名称
projectId int, --项目编号【FK】
salary money, --发放金额【单个项目|一系列项目总额】
pubdate datetime --发放日期
) print'福利发放系统创建成功!' select amountIssuingId,employeeId,departmentId,departmentName,projectId,salary,pubdate from AmountIssuing

1.B.2,alter.sql

use WelfareSystem
go
--1,把项目表类型列,修饰类型换为varchar
alter table Project
alter column [type] varchar(20) alter table Employee
alter column [id] varchar(30) alter table Employee
alter column cardNo varchar(30) alter table Employee
alter column state varchar(8)
alter table Employee
alter column isRent varchar(20) alter table Employee
alter column sex varchar(6) --注意检查约束 alter table Employee
alter column toRegularDate varchar(20) --把允许为空的日期类型换成字符串修饰符 alter table Employee
alter column hireDate varchar(20) --把允许为空的日期类型换成字符串修饰符 alter table Children
alter column sex varchar(6) alter table Children
alter column isOnlyChild varchar(10) --begin-去除原先Char修饰符产生的多余空格
select employeeId,SUBSTRING([id],1,len([id])) from Employee where employeeId=1404 update Project set [type]= SUBSTRING([type],1,len([type]))
go
update Employee set [id]= SUBSTRING([id],1,len([id])),cardNo=SUBSTRING([cardNo],1,len([cardNo]))
,sex=SUBSTRING([sex],1,len([sex])),state=SUBSTRING([state],1,len([state]))
,isRent=SUBSTRING([isRent],1,len([isRent])),toRegularDate=SUBSTRING([toRegularDate],1,len([toRegularDate])) go
update Children set [sex]= SUBSTRING([sex],1,len([sex])),isOnlyChild=SUBSTRING([isOnlyChild],1,len([isOnlyChild])) --end-去除原先Char修饰符产生的多余空格 --2,
update WelfareSystem.dbo.Children set howManyChild='第一胎' where isOnlychild='' or isOnlychild is null
update WelfareSystem.dbo.Children set howManyChild='非第一胎' where isOnlychild='' --3,移除“身份帐号”
alter table Children
drop column [id] update employee set state='正式内' where state='内'
update employee set state='正式外' where state='外' -- =============================================
-- ylb: 5,用户表
-- =============================================
create table Users
(
username varchar(100) unique not null, --姓名【UN】
userpass varchar(100) not null --密码
) insert into Users(username,userpass) values('admin','m12345') alter table AmountIssuing
add [year] int alter table AmountIssuing
add [month] int alter table AmountIssuing
add hireDate varchar(30) alter table AmountIssuing
add toRegularDate varchar(30) alter table AmountIssuing
add [state] varchar(30) --NewAdd alter table projectAnnualIssue
add projectAnnualIssueGuid uniqueidentifier --项目发放编号【FK】 alter table AmountIssuing
add projectAnnualIssueGuid uniqueidentifier --项目发放编号【FK】 alter table projectAnnualIssue
add flagNgn int default(0) --财务工会是否生成凭证 0:未生成;1:已生成 --年度
create table Annual
(
annualId int primary key identity(1,1),
[year] int,
[month] int
) alter table Project
add kmdm varchar(30) --科目代码 alter table Department
add [type] varchar(30) --部门区域京内、京外
update Department set [type]='京内' alter table Employee
add [type] varchar(30) --职工状态 在职、离职、退休 update Employee set [type]='在职'

1.B.3,年底独子费补发.sql

use WelfareSystem
go alter table Children
add duZi varchar(20) --独子 有;无 update Children set duZi='无'
go
update Children set duZi='有' where howManyChild='第一胎' alter table Children
add remark varchar(500) --备注 alter table Children
add flagDuZi varchar(20) --独子补发表标识,1:年底要补发;0:已经补发过 alter table Children
add updateDate datetime --补充独子证书时间 alter table Children
add remark varchar(500) --备注 select * from Children /***
select duZi,flagDuZi,updateDate,remark from Children select * from Employee where employeeId in(select employeeId from Children where flagDuZi='1') select employeeId from Children where flagDuZi='1' select e.hireDate,c.birthdate, c.updateDate,* from Employee e
inner join Department d on e.departmentId=d.departmentId
inner join Children c on e.employeeId=c.employeeId
where e.[type]='在职' and c.flagDuZi='1'
order by e.departmentId asc, e.employeeId asc update Children set flagDuZi='0'
***/

1.B.4,

1.C,功能实现代码(Function Implementation Code)返回顶部
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

ylbtech-dbs:ylbtech-7,welfareSystem(福利发放系统)的更多相关文章

  1. ylbtech-WelfareSystem(福利发放管理系统)-数据库设计

    ylbtech-DatabaseDesgin:ylbtech-WelfareSystem(福利发放管理系统)-数据库设计 1.A,数据库关系图(Database Diagram) 1.B,数据库设计脚 ...

  2. Sql Server之旅——第一站 那些给我们带来福利的系统视图

    本来想这个系列写点什么好呢,后来想想大家作为程序员,用的最多的莫过于数据库了,但是事实上很多像我这样工作在一线的码农,对sql 都一知半解,别谈优化和对数据库底层的认识了,我也是这样... 一:那些系 ...

  3. util-C# 复杂条件查询(sql 复杂条件查询)查询解决方案

    ylbtech-funcation-util:  C# 复杂条件查询(sql 复杂条件查询)查询解决方案 C# 复杂条件查询(sql 复杂条件查询)查询解决方案 1.A,Ylbtech.Model返回 ...

  4. 代理IP爬取,计算,发放自动化系统

    IoC Python端 MySQL端 PHP端 怎么使用 这学期有一门课叫<物联网与云计算>,于是我就做了一个大作业,实现的是对代理IP的爬取,计算推荐,发放给用户等任务的的自动化系统.由 ...

  5. Linux系统——MySQL基础(一)

    # 数据库 ## 数据库简单的分类:(1)关系型数据库:MySQL和Oracle.Postgresql(2)非关系型数据库:Memcached和Redis(3)消息队列中间件(4)搜索引擎数据库:El ...

  6. zz《百度地图商业选址》

    作者 | 阚长城 编辑 | 张慧芳 题图 | 站酷海阔 人类几千年的文明催生了城市的发展,计算机与复杂科学带给我们新的资源——大数据.罗马非一日建成,人力和时间成本极大,但试想一下,如果有了大数据,罗 ...

  7. 【springcloud】hystrix面试题

    1 hystrix是什么? Netflix(国外最大的类似于,爱奇艺,优酷)视频网站,五六年前,也是,感觉自己的系统,整个网站,经常出故障,可用性不太高 有时候一些vip会员不能支付,有时候看视频就卡 ...

  8. 密码算法详解——DES

    0 DES简介 在20世纪60年代后期,IBM公司成立了一个由Horst Feistel负责的计算机密码学研究项目.1971年设计出密码算法LUCIFER后,该项目宣告结束.LUCIFER被卖给了伦敦 ...

  9. 机器学习基石第一讲:the learning problem

    博客已经迁移至Marcovaldo's blog (http://marcovaldong.github.io/) Andrew Ng的Machine Learning比較简单,已经看完.林田轩的机器 ...

随机推荐

  1. AS3 Embed用法笔记

    1. 用[Embed]元数据标签可以嵌入GIF,PNG,JPEG,或者MP3文件.ActionScript代码的顺序非常重要.你必须在声明变量前添加[Embed]元数据标签,而且这个变量的类型会是Cl ...

  2. (转) Deep Learning in a Nutshell: Reinforcement Learning

    Deep Learning in a Nutshell: Reinforcement Learning   Share: Posted on September 8, 2016by Tim Dettm ...

  3. Java static block static constructor , static field

    http://stackoverflow.com/questions/7121213/singleton-instantiation http://docs.oracle.com/javase/spe ...

  4. tomcat 源码解析

    how_tomcat_works https://www.uzh.ch/cmsssl/dam/jcr:00000000-29c9-42ee-0000-000074fab75a/how_tomcat_w ...

  5. Microservice Orleans

    https://azure.microsoft.com/en-us/blog/containers-docker-windows-and-trends/ https://channel9.msdn.c ...

  6. Unity代码热更新方案 JSBinding + SharpKit 首页

    目前Unity的代码更新方案有很多,主要以lua为主. JSBinding + SharpKit 是一种新的技术,他做了两件事情: JSBinding将C#导出到 JavaScript (引擎是 Mo ...

  7. eclipse cdt代码悬停窗口背景颜色设置(转载)

    在eclipse中编写C++代码时,有一个很方便的功能,是当鼠标停放在某一个函数或变量上不同时,会出现一个悬停框,显示该函数或变量的声明 体.但是, 从Ubuntu 10.04之后,这个悬停框便出现了 ...

  8. Wireshark-BPF过滤规则

    设置过滤规则就是让网络设备只是捕获我们感兴趣的网络数据包,如果没有设置过滤规则,即上面的 filter_app 是空字符串,那么网络设备就捕获所有类型的数据包,否则只是捕获过滤规则设置的数据包,此时过 ...

  9. 使用git提交github代码

    新的项目的提交 touch README.md git init git add README.md git commit -m "first commit" git remote ...

  10. 全文检索引擎 Lucene.net

    全文搜索引擎是目前广泛应用的主流搜索引擎.它的工作原理是计算机索引程序通过扫描文章中的每一个词,对每一个词建立一个索引,指明该词在文章中出现的次数和位置,当用户查询时,检索程序就根据事先建立的索引进行 ...