ylbtech-dbs:ylbtech-7,welfareSystem(福利发放系统)
| 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(福利发放系统)的更多相关文章
- ylbtech-WelfareSystem(福利发放管理系统)-数据库设计
ylbtech-DatabaseDesgin:ylbtech-WelfareSystem(福利发放管理系统)-数据库设计 1.A,数据库关系图(Database Diagram) 1.B,数据库设计脚 ...
- Sql Server之旅——第一站 那些给我们带来福利的系统视图
本来想这个系列写点什么好呢,后来想想大家作为程序员,用的最多的莫过于数据库了,但是事实上很多像我这样工作在一线的码农,对sql 都一知半解,别谈优化和对数据库底层的认识了,我也是这样... 一:那些系 ...
- util-C# 复杂条件查询(sql 复杂条件查询)查询解决方案
ylbtech-funcation-util: C# 复杂条件查询(sql 复杂条件查询)查询解决方案 C# 复杂条件查询(sql 复杂条件查询)查询解决方案 1.A,Ylbtech.Model返回 ...
- 代理IP爬取,计算,发放自动化系统
IoC Python端 MySQL端 PHP端 怎么使用 这学期有一门课叫<物联网与云计算>,于是我就做了一个大作业,实现的是对代理IP的爬取,计算推荐,发放给用户等任务的的自动化系统.由 ...
- Linux系统——MySQL基础(一)
# 数据库 ## 数据库简单的分类:(1)关系型数据库:MySQL和Oracle.Postgresql(2)非关系型数据库:Memcached和Redis(3)消息队列中间件(4)搜索引擎数据库:El ...
- zz《百度地图商业选址》
作者 | 阚长城 编辑 | 张慧芳 题图 | 站酷海阔 人类几千年的文明催生了城市的发展,计算机与复杂科学带给我们新的资源——大数据.罗马非一日建成,人力和时间成本极大,但试想一下,如果有了大数据,罗 ...
- 【springcloud】hystrix面试题
1 hystrix是什么? Netflix(国外最大的类似于,爱奇艺,优酷)视频网站,五六年前,也是,感觉自己的系统,整个网站,经常出故障,可用性不太高 有时候一些vip会员不能支付,有时候看视频就卡 ...
- 密码算法详解——DES
0 DES简介 在20世纪60年代后期,IBM公司成立了一个由Horst Feistel负责的计算机密码学研究项目.1971年设计出密码算法LUCIFER后,该项目宣告结束.LUCIFER被卖给了伦敦 ...
- 机器学习基石第一讲:the learning problem
博客已经迁移至Marcovaldo's blog (http://marcovaldong.github.io/) Andrew Ng的Machine Learning比較简单,已经看完.林田轩的机器 ...
随机推荐
- UMDH
1. 什么是UMDH UMDH=User Mode dump heap.把进程的堆dump下来.包括堆栈信息.UMDH是WinDbg附带的一个工具. 2. 下载安装 WinDbg.完事后在WinDbg ...
- 学习Logistic Regression的笔记与理解(转)
学习Logistic Regression的笔记与理解 1.首先从结果往前来看下how logistic regression make predictions. 设我们某个测试数据为X(x0,x1, ...
- ID3算法 决策树的生成(2)
# coding:utf-8 import matplotlib.pyplot as plt import numpy as np import pylab def createDataSet(): ...
- 二十四种设计模式:原型模式(Prototype Pattern)
原型模式(Prototype Pattern) 介绍用原型实例指定创建对象的种类,并且通过拷贝这个原型来创建新的对象.示例有一个Message实体类,现在要克隆它. MessageModel usin ...
- JavaScript 全选函数的实现
Html代码: <table id="purchase-info" class="table table-bordered table-hover table-st ...
- linux包之procps之vmstat命令
概述 [root@localhost ~]# rpm -qf /usr/bin/vmstatprocps-3.2.8-25.el6.x86_64 vmstat是一个很全面的性能分析工具,可以观察到系统 ...
- ORA-12545:因目标主机或对象不存在,连接失败!
错误原因是配置错误主机名 解决: 1. 搜索你自己安装的Oracle路径,找到这俩个文件 tnsnames.ora 和 listener.ora,修改这两个文件,修改HOST=自己的主机名 我的路径如 ...
- maven本地仓库
引入某一个站点的jar包 <repositories> <repository> <id>maven.seasar.org</id> <name& ...
- php 获取中文的拼音
注意事项: 无法识别的中文 亳:bo,如果有此字,结果为空,调用此类之前需要手动加判断 蚌:bang,beng,多音字 莞:guan 圳:zhen 儋:dan 漯:luo 濮:pu 泸:lu 衢:qu ...
- beego里面自定义配置文件
beego编译好的exe通过全路径调用会crash,看了半天,发现是解析不到配置文件,研究了下 发现beego自定义配置文件以后,需要手工parse,我表示,以为是自动化的,没想到是半自动化的…… 追 ...
