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. [poj 3261]Milk Patterns

    后缀数组搞一下就可以了喵~ 其实这道题的第一个想法是 SAM ,建完后缀自动机后拓扑排序跑一遍统计下每个子串的出现次数就 O(N) 就妥妥过掉了 后缀树也是 O(N) 的,统计一下每个节点对应的子树中 ...

  2. flashbuilder发布release版本

    http://blog.vini123.com/1275.html 方法二:选择项目,点击“文件”-“导出”-“Flash Builder”-“发行版”,然后下一步. 方法三:选择项目,右键“属性”, ...

  3. 论文笔记之:Learning Multi-Domain Convolutional Neural Networks for Visual Tracking

    Learning Multi-Domain Convolutional Neural Networks for Visual Tracking CVPR 2016 本文提出了一种新的CNN 框架来处理 ...

  4. GlassFish Server is a compliant implementation of the Java EE 7 platform

    1.9 GlassFish Server Tools GlassFish Server is a compliant implementation of the Java EE 7 platform. ...

  5. set and Sequence theory

    https://en.wikipedia.org/wiki/Class_(set_theory) https://en.wikipedia.org/wiki/Zermelo%E2%80%93Fraen ...

  6. 查看jquery绑定的事件函数

    作为技术狂热分子的职业本能,看到一个技术产品的功能,总会忍不住想知道它是怎么被实现的.比如我每每看到别人网站一个很炫的界面或者很酷的功能,就忍不住打开了浏览器的控制台... 好,不扯远,说说当你想看到 ...

  7. Oracle数据库概述

    Oracle是一种RDBMS(Relational Database Management System 关系型数据库管理系统),是Oracle公司的核心产品. 2009年4月,Oracle并购了Su ...

  8. linux概念之cpu分析

    http://ilinuxkernel.com/?cat=4 Linux CPU占用率原理与精确度分析1  CPU占用率计算原理在Linux/Unix 下,CPU 利用率分为用户态.系统态和空闲态,分 ...

  9. The repository for high quality TypeScript type definitions

    Best practices This is a guide to the best practices to follow when creating typing files. There are ...

  10. Exploring the Angular 1.5 .component() method

    Angular 1.5 introduced the .component() helper method, which is much simpler than the.directive() de ...