博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
DBS-Tally book(记账本)
阅读量:5039 次
发布时间:2019-06-12

本文共 6170 字,大约阅读时间需要 20 分钟。

ylbtech-dbs:DBS-Tally book(记账本)

-- =============================================

-- 记账本
-- 模仿小程序“记账e”业务流程
-- 13:17 2017/3/15
-- author:yb,gyg
-- =============================================

1,数据库关系图(Database Diagram)

 

2,数据库设计脚本(Database Design Script)

V-2.2,

-- =============================================-- 记账本-- 模仿小程序“记账e”业务流程-- 13:17 2017/3/15-- author:yb,gyg-- =============================================USE masterGO-- Drop the database if it already existsIF  EXISTS (SELECT name FROM sys.databases WHERE name = N'SB_TallyBook')DROP DATABASE SB_TallyBookGOCREATE DATABASE SB_TallyBookGOuse SB_TallyBookGO-- =============================================-- 科目表-- =============================================create table [Subject](subjectId uniqueidentifier primary key,--编号【UI、PK】subjectCode varchar(50),--科目代码subjectName varchar(50),--分类名称subjectType bit,--类别:0=收入-来源;1=支付-用途flagDisabled bit    --是否排除)GO-- =============================================-- 账单表-- =============================================create table Bill(billId uniqueidentifier primary key,--编号【UI、PK】subjectCode varchar(50),--科目代码amount money,--金额payWay varchar(50),--支付方式remark varchar(200),--备注pubdate datetime, --日期accountId uniqueidentifier,--账户ID【UI、UQ】flagDisabled bit    --是否排除)GO-- =============================================-- 测试数据-- =============================================-- 收入科目insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'400','收入',0,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'40101','工资薪水',0,0)GO-- 支出科目insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'500','食',1,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'50101','早餐',1,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'50102','午餐',1,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'50103','晚餐',1,0)GO-- =============================================-- 操作-- =============================================go-- 1、记一笔-- 1.1、记一笔收入insert Bill(billId,amount,subjectCode,payWay,remark,pubdate,accountId,flagDisabled)values(NEWID(),0,10000,'400','储蓄卡','2月分工资','2017-3-10',NEWID(),0)-- 1.2、记一笔支出insert Bill(billId,amount,subjectCode,payWay,remark,pubdate,accountId,flagDisabled)values(NEWID(),0,200,'500','现金','请客户吃饭','2017-3-17',NEWID(),0)-- 2、账单-- 2.1、账单-分时-- 2.1.1、?如果按日期分组,例如:2017-3;2017-2-- 2.1.2、select b.billId,b.billType,b.amount,b.subjectCode,b.payWay,b.remark,b.pubdate,b.flagDisabled,s.subjectType,s.subjectName from Bill b inner join [Subject] s on b.subjectCode=s.subjectCodewhere b.accountId='' and b.pubdate=''-- 2.2、账单-分类-- 2.2.1、select b.subjectCode,COUNT(*)'cnt' from Bill bgroup by b.subjectCodehaving b.accountId=''-- 2.2.2、select b.billId,b.billType,b.amount,b.subjectCode,b.payWay,b.remark,b.pubdate,b.flagDisabled,s.subjectType,s.subjectName from Bill b inner join [Subject] s on b.subjectCode=s.subjectCodewhere b.accountId='' and b.subjectCode=''
View Code

V-2.1,

-- =============================================-- 记账本-- 模仿小程序“记账e”业务流程-- 13:17 2017/3/15-- author:yb,gyg-- =============================================USE masterGO-- Drop the database if it already existsIF  EXISTS (SELECT name FROM sys.databases WHERE name = N'SB_TallyBook')DROP DATABASE SB_TallyBookGOCREATE DATABASE SB_TallyBookGOuse SB_TallyBookGO-- =============================================-- 科目表-- =============================================create table [Subject](subjectId uniqueidentifier primary key,--编号【UI、PK】subjectCode varchar(50),--科目代码subjectName varchar(50),--分类名称subjectType bit,--类别:0=收入-来源;1=支付-用途flagDisabled bit    --是否排除)GO-- =============================================-- 账单表-- =============================================create table Bill(billId uniqueidentifier primary key,--编号【UI、PK】billType bit,--类别:0=收入;1=支付amount money,--金额subjectCode varchar(50),--科目代码payWay varchar(50),--支付方式remark varchar(200),--备注pubdate datetime, --日期accountId uniqueidentifier,--账户ID【UI、UQ】flagDisabled bit    --是否排除)GOGO-- =============================================-- 测试数据-- =============================================-- 收入科目insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'400','收入',0,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'40101','工资薪水',0,0)GO-- 支出科目insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'500','食',1,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'50101','早餐',1,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'50102','午餐',1,0)insert [Subject](subjectId,subjectCode,subjectName,subjectType,flagDisabled)values(NEWID(),'50103','晚餐',1,0)GO-- =============================================-- 操作-- =============================================go-- 1、记一笔-- 1.1、记一笔收入insert Bill(billId,billType,amount,subjectCode,payWay,remark,pubdate,accountId,flagDisabled)values(NEWID(),0,10000,'400','储蓄卡','2月分工资','2017-3-10',NEWID(),0)-- 1.2、记一笔支出insert Bill(billId,billType,amount,subjectCode,payWay,remark,pubdate,accountId,flagDisabled)values(NEWID(),0,200,'500','现金','请客户吃饭','2017-3-17',NEWID(),0)-- 2、账单-- 2.1、账单-分时-- 2.1.1、?如果按日期分组,例如:2017-3;2017-2-- 2.1.2、select b.billId,b.billType,b.amount,b.subjectCode,b.payWay,b.remark,b.pubdate,b.flagDisabled,s.subjectType,s.subjectName from Bill b inner join [Subject] s on b.subjectCode=s.subjectCodewhere b.accountId='' and b.pubdate=''-- 2.2、账单-分类-- 2.2.1、select b.subjectCode,COUNT(*)'cnt' from Bill bgroup by b.subjectCodehaving b.accountId=''-- 2.2.2、select b.billId,b.billType,b.amount,b.subjectCode,b.payWay,b.remark,b.pubdate,b.flagDisabled,s.subjectType,s.subjectName from Bill b inner join [Subject] s on b.subjectCode=s.subjectCodewhere b.accountId='' and b.subjectCode=''
View Code

2.0,

3,功能实现代码(Function Implementation Code)

 

warn 作者:
出处:
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

转载于:https://www.cnblogs.com/ylbtech/p/6582220.html

你可能感兴趣的文章
weblogic加载hibernate3时,ClassNotFoundException的解决方法
查看>>
我的软件工程之路(三)
查看>>
Nastya Studies Informatics CodeForces - 992B (大整数)
查看>>
Kilani and the Game CodeForces - 1105D (bfs)
查看>>
通过普通用户向各个节点服务器分发文件到各个目录
查看>>
SpringBoot swagger-ui.html 配置类继承 WebMvcConfigurationSupport 类后 请求404
查看>>
深入理解计算机系统(2.4)------整数的表示(无符号编码和补码编码)
查看>>
TCP/IP详解学习笔记(4)-ICMP协议,ping和Traceroute
查看>>
01 Linear Regression with One Variable
查看>>
计算矩阵转置函数的步总数公式
查看>>
【Linux】- CentOS 防火墙iptables和firewall
查看>>
selenium安装及官方文档
查看>>
【SVN】导出项目后报错汇总
查看>>
使用Redis存取数据+数据库存取(spring+java)
查看>>
MySQL教程(六)—— 数据库的创建与删除
查看>>
2018.11.24 poj2774Long Long Message(后缀数组)
查看>>
Python之路【第十六篇】Django基础
查看>>
nyoj 最长公共子序列(LCS)
查看>>
java基础 三 概念和java程序的结构.
查看>>
jedis应用实例
查看>>