审计署计算机中级考试会电语句.docx

上传人:b****2 文档编号:2535405 上传时间:2023-05-03 格式:DOCX 页数:23 大小:24.94KB
下载 相关 举报
审计署计算机中级考试会电语句.docx_第1页
第1页 / 共23页
审计署计算机中级考试会电语句.docx_第2页
第2页 / 共23页
审计署计算机中级考试会电语句.docx_第3页
第3页 / 共23页
审计署计算机中级考试会电语句.docx_第4页
第4页 / 共23页
审计署计算机中级考试会电语句.docx_第5页
第5页 / 共23页
审计署计算机中级考试会电语句.docx_第6页
第6页 / 共23页
审计署计算机中级考试会电语句.docx_第7页
第7页 / 共23页
审计署计算机中级考试会电语句.docx_第8页
第8页 / 共23页
审计署计算机中级考试会电语句.docx_第9页
第9页 / 共23页
审计署计算机中级考试会电语句.docx_第10页
第10页 / 共23页
审计署计算机中级考试会电语句.docx_第11页
第11页 / 共23页
审计署计算机中级考试会电语句.docx_第12页
第12页 / 共23页
审计署计算机中级考试会电语句.docx_第13页
第13页 / 共23页
审计署计算机中级考试会电语句.docx_第14页
第14页 / 共23页
审计署计算机中级考试会电语句.docx_第15页
第15页 / 共23页
审计署计算机中级考试会电语句.docx_第16页
第16页 / 共23页
审计署计算机中级考试会电语句.docx_第17页
第17页 / 共23页
审计署计算机中级考试会电语句.docx_第18页
第18页 / 共23页
审计署计算机中级考试会电语句.docx_第19页
第19页 / 共23页
审计署计算机中级考试会电语句.docx_第20页
第20页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

审计署计算机中级考试会电语句.docx

《审计署计算机中级考试会电语句.docx》由会员分享,可在线阅读,更多相关《审计署计算机中级考试会电语句.docx(23页珍藏版)》请在冰点文库上搜索。

审计署计算机中级考试会电语句.docx

审计署计算机中级考试会电语句

第六章

1.1检索出10月份的收字2号凭证

select*fromGL_accvouch

whereiperiod=10andcsign='收'andino_id=2

1.2检索出所有现金支出为10000元以上的凭证

select*fromGL_accvouch

whereccode='101'andmc>10000

1.3cname字段记录了业务经手人,以该字段为分组一句,计算每位经手人的现金支出金额和业务笔数

selectcname经手人,sum(mc)支出经手总金额,count(cname)业务笔数fromGL_accvouch

whereccode='101'andmc<>0groupbycname

1.4检索出现金支出为整万元的记录

select*fromGL_accvouchwhereccodelike'101%'andmc>0

andcast((mc/1000.0)asint)=mc/1000.0

1.5计算出各位的现金支出合计金额

selectMONTH(dbill_date)月份,SUM(mc)支出fromGL_accvouchwhereccode='101'andmc<>0

groupbymonth(dbill_date)

1.6创建一个视图,包含期间、凭证类型、凭证号、科目代码、摘要、借方金额、贷方金额、对方科目

createview凭证表

as

selectiperiod[会计期间],csign[凭证类别],ino_id[凭证号],inid[行号],

dbill_date[制单日期],iflag[凭证有效],cdigest[摘要],

ccode[科目编码(与科目主表关联)],md[借方金额],

mc[贷方金额],ccode_equal[对方科目],coutbillsign[外部凭证单据类型],

coutid[外部凭证单据号]

fromGL_accvouch

createview[账户主文件(余额表)]asselect

ccode[科目编码(与科目主表关联)],iperiod[会计期间],

cbegind_c[金额期初方向(借,贷,mb=0时为平)],mb[金额期初],md[金额借方合计],

mc[金额贷方合计],cendd_c[金额期末方向],me[金额期末]

fromgl_accsum

createview[科目代码表]asselect

ccode[科目代码],ccode_name[科目名称],bend[是否末级科目],

igrade[第几级科目]fromcode

1.7检索出摘要包含“劳务”、“费用”等内容的记录

select*fromGL_accvouch

where(cdigestlike'%收%款%'orcdigestlike'%费%用%')

and(md>1000ormc>1000)

1.8检索出12月份的主营业务收入明细账

1.9检查凭证表的有效、完整性,对凭证文件借方发生额、贷方发生额进行求和检查借贷是否平衡

selectSUM(md)借方金额合计,sum(mc)贷方金额合计,

case

whenSUM(md)=sum(mc)then'借贷方平衡'

else'借贷方不平衡'

EnD是否平衡

fromdbo.GL_accvouch

检查具体是哪个凭证不平衡

selectiperiod,csign,ino_id,SUM(md)借方金额合计,sum(mc)贷方金额合计,

case

whenSUM(md)=sum(mc)then'借贷方平衡'

else'借贷方不平衡'

EnD是否平衡

fromdbo.GL_accvouchgroupbyiperiod,csign,ino_idhaving

SUM(md)<>sum(mc)

orderbyiperiod,csign,ino_id

2.1检索出各总账科目的年初余额

selectccode,cbegind_c,mbfromGL_accsum

whereLEN(ccode)=3andiperiod='1'

orderbyccode

2.2检索出各总账科目的各月借贷方发生额

2.3检索出销售收入与销售成本科目的各月发生额

selecta.iperiod会计期间,a.ccode科目代码,a.mc收入,b.ccode支出科目,b.md支出

from(select*fromGL_accsumwhereccodelike'501%')ajoin

(select*fromGL_accsumwhereccodelike'502%')b

ona.iperiod=b.iperiod

2.4检索出各总账科目的年末余额

selectccode,cbegind_c,mbfromGL_accsum

whereLEN(ccode)=3andiperiod='12'

orderbyccode

2.5检索出收入科目各月贷方发生额

selectccode,iperiod,mc

fromGL_accsum

whereccodein(selectccodefromcodewhereccode_namelike'%收入%')

或者:

selectccode,iperiod,mcfromGL_accsum

whereccodein('501','511','541')

2.6检索出销售收入与销售成本科目各月发生额

同2.3

2.7检索出应收账款科目的年末余额

selectccode,mefromGL_accsum

whereccodein(selectccodefromcodewhereccode_namelike'%应收账款%')andiperiod=12

3.1创建一个视图包含期间、凭证类型、凭证号、科目代码、科目名称、摘要、借方金额、贷方金额、对方科目

createviewv1

as

select

iperiod,ino_id,csign,ccode_name,cdigest,md,mc,ccode_equal

fromcodecjoinGL_accvouchgonc.ccode=g.ccode

3.2创建一个视图,包含总账科目代码、总账科目名称、年初余额方向、年初余额等内容

createviewv2

as

selectc.ccode,c.ccode_name,cbegind_c,g.mb

fromcodecjoinGL_accsumgonc.ccode=g.ccode

whereg.iperiod=1andLEN(g.ccode)=3

余额表的另外两种表示方式:

借贷方向式

selectiperiod,csign,ino_id,ccode,cdigest,借贷方向=

casewhenmd<>0then'借'else'贷'end,金额=md+mc,ccode_equal

fromdbo.GL_accvouch

orderbyiperiod,ino_id

正负余额式

selectiperiod,csign,ino_id,ccode,cdigest,

md借方金额,mc贷方金额,

借贷方向=casewhenmd-mc>0then'借'else'贷'end,金额=md-mc,

正负金额=md-mc

fromGL_accvouch

orderbyiperiod,ino_id

第七章

1.1生成新的科目代码表,科目代码级次结构为3344

selectccode_name,bend,ccode=

case

whenlen(ccode)=5thenleft(ccode,3)+'0'+right(ccode,2)

whenlen(ccode)=7thenleft(ccode,3)+'0'+substring(ccode,4,2)+

'00'+right(ccode,2)

whenlen(ccode)=9thenleft(ccode,3)+'0'+substring(ccode,4,2)+

'00'+substring(ccode,6,2)+'00'+right(ccode,2)

elseccodeend

intonewcodefromcode

1.2检索出12月份登记主营业务收入科目的记账凭证

selecta.*fromgl_accvouchajoingl_accvouchb

ona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_id

whereb.iperiod=12andb.ccodelike'501%'

orderbya.iperiod,a.csign,a.ino_id,a.inid

1.3检索出所有通过应收账款科目核算主营业务收入的记账凭证

selectc.*fromgl_accvouchajoingl_accvouchb

ona.csign=b.csignanda.iperiod=b.iperiodanda.ino_id=b.ino_id

joingl_accvouchc

onc.csign=a.csignandc.iperiod=a.iperiodandc.ino_id=a.ino_id

whereb.ccodelike'501%'andb.mc<>0anda.ccodelike'113%'anda.md<>0

1.4检索出所有确认收入时,未提取应交增值税的收入明细账记录

createviewa_501

as

select*fromgl_accvouch

whereccodelike'501%'andmc<>0

createviewa_221

as

select*fromgl_accvouch

whereccodelike'221%'andmc<>0

selecta.*froma_501a

leftjoina_221b

ona.csign=b.csignanda.iperiod=b.iperiodanda.ino_id=b.ino_id

whereb.ccodeisnull

--查找出确认收入时漏记税款的凭证

createviewa_501

as

selecta.*fromgl_accvoucha

joinGL_accvouchb

ona.csign=b.csignanda.iperiod=b.iperiodanda.ino_id=b.ino_id

whereb.ccodelike'501%'andb.mc<>0

createviewa_221

as

select*fromgl_accvouch

whereccodelike'221%'andmc<>0

selecta.*froma_501a

leftjoina_221b

ona.csign=b.csignanda.iperiod=b.iperiodanda.ino_id=b.ino_id

whereb.ccodeisnull

 

1.5检查所转换数据的有效完整性,需要汇总出凭证文件中各科目的各月发生额与余额文件相关科目的发生额一致性检查。

createviewa_3--凭证表数据

as

selectccode,iperiod,sum(md)summd,sum(mc)summcfromgl_accvouch

groupbyiperiod,ccode

selecta.ccode科目代码,a.iperiod余额表会计期间,

md余额表借方合计,mc余额表贷方合计,b.iperiod凭证表会计期间,

isnull(summd,0)凭证表借方合计,isnull(summc,0)凭证表贷方合计

fromgl_accsuma

fulljoina_3bona.ccode=b.ccodeanda.iperiod=b.iperiod

whereisnull(a.md,0)<>isnull(b.summd,0)orisnull(a.mc,0)<>isnull(b.summc,0)--ora.ccodeisnullorb.ccodeisnull

orderbya.ccode,a.iperiod,b.iperiod

createviewpz

as

selectccode,iperiod,SUM(md)summd,SUM(mc)summcfromGL_accvouch

--whereibook=1

groupbyccode,iperiod

createviewye

as

selectccode,iperiod,md,mcfromGL_accsum

whereccodein(selectccodefromcodewherebend=1)

andiperiodin(selectdistinctiperiodfromGL_accvouch)

selecta.ccode,a.iperiod,a.summd,a.summc,b.ccode,b.iperiod,b.md,b.mcfrompza

fulljoinyeb

ona.ccode=b.ccodeanda.iperiod=b.iperiod

whereisnull(a.summd,0)<>isnull(b.md,0)orisnull(a.summc,0)<>isnull(b.mc,0)

ora.ccodeisnullorb.ccodeisnull

orderbya.ccode,a.iperiod

1.6从gl_accvouch表中检索计算出各月的销售收入、销售成本、税金(产品销售税金及附加,并计算各月的销售毛利率。

毛利率=(销售收入-isnull销售成本-isnull税金)/销售收入)

createviewa_sr1

as

selectccode,iperiod,sum(mc)sum_shouru

fromgl_accvouch

whereccodelike'501%'

groupbyccode,iperiod

createviewa_cb1

as

selectccode,iperiod,sum(md)sum_chengben

fromgl_accvouch

whereccodelike'502'

groupbyccode,iperiod

createviewa_sj1

as

selectccode,iperiod,sum(md)sum_shuijin

fromgl_accvouch

whereccodelike'504'

groupbyccode,iperiod

select*froma_sr

select*froma_cb

select*froma_sj

--未排除空值情况下的检索

selecta.iperiod月份,sum_shouru收入,sum_chengben成本,sum_shuijin税金,((a.sum_shouru-b.sum_chengben-c.sum_shuijin)/a.sum_shouru)毛利率

froma_sra

joina_cbb

ona.iperiod=b.iperiod

joina_sjc

ona.iperiod=c.iperiod

--排除空值情况下的检索

selectisnull(c.iperiod,isnull(b.iperiod,a.iperiod))月份,isnull(sum_shouru,0)收入,isnull(sum_chengben,0)成本,

isnull(sum_shuijin,0)税金,

毛利率=case

whenisnull(sum_shouru,0)=0then999999999999999999--分母为零除法无意义,

else

(isnull(sum_shouru,0)-isnull(sum_chengben,0)-isnull(sum_shuijin,0))/isnull(sum_shouru,0)

end

froma_sr1a

fulljoina_cb1bona.iperiod=b.iperiod

fulljoina_sj1cona.iperiod=c.iperiod

 

selecta.iperiod,isnull(a.sr,0)sr,isnull(b.cb,0)cb,isnull(c.sj,0)sj,(isnull(a.sr,0)-isnull(b.cb,0)-isnull(c.sj,0))/isnull(a.sr,0)mlr

froma_srafulljoina_cbbona.iperiod=b.iperiod

fulljoina_sjcona.iperiod=c.iperiod

1.7审计人员为了进行帐表核对,需要根据帐户主文件(gl_accsum)中所记录的年初余额

和交易文件(gl_accvouch)中所记录的交易数据,汇总计算出各总帐科目的年初余额和年末余额--查询结果中应包括三个字段(科目代码,年初余额,年末余额),其中余额的方向通过金额的正负来表示。

createviewv_jyeas

selectleft(ccode,3)ccode1,sum(md)-sum(mc)jyje

fromgl_accvouch

groupbyleft(ccode,3)

createviewv_ncas

selecttop100percentccode,ncje=

casewhencbegind_c='借'thenmbelsemb*(-1)end

fromgl_accsum

wherelen(ccode)=3andiperiod=1

orderbyccode

selecta.ccode,a.ncje,isnull(a.ncje,0)+isnull(b.jyje,0)nmje

fromv_nca

fulljoinv_jyeb

ona.ccode=b.ccode1

orderbya.ccode

1.8计算各月通过赊销方式实现的销售收入

selecta.iperiod,sum(a.mc)fromgl_accvouchajoingl_accvouchbon

a.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_id

whereb.ccodelike'113%'anda.ccodelike'501%'

groupbya.iperiod

第九章

1.1检查发货单是否连续编号(断号、重号)

selectcvouchtype,max(cdlcode)发货单号,min(cdlcode)最大号,count(distinctcdlcode)计数

fromdispatchlist

groupbycvouchtype

--查找出不正常数据

havingcast(max(cdlcode)asint)-cast(min(cdlcode)asint)+1<>count(distinctcdlcode)

--重号

selectcvouchtype,cdlcode,count(*)fromdispatchlist

groupbycvouchtype,cdlcode

havingcount(*)>1

1.2检索出所有未登记主营业务收入明细账的发票

createviewv_501as

select*fromgl_accvouchwhereccodelike'501%'

selecta.*fromsalebillvoucha

leftjoinv_501bona.cvouchtype=b.coutbillsign

anda.csbvcode=b.coutid

whereb.coutidisnull

1.3审计人员为检查主营业务收入记账金额是否准确,将主营业务收入明细账与相关发票金额进行核对

createviewv_fpas

selecta.cvouchtype,a.csbvcode,sum(b.inatmoney)fpje

fromsalebillvouchajoinsalebillvouchsbona.sbvid=b.sbvid

groupbya.cvouchtype,a.csbvcode

selecta.iperiod,a.csign,a.ino_id,b.cvouchtype,b.csbvcode,a.mc,b.fpje

fromgl_accvoucha

joinv_fpbona.coutbillsign=b.cvouchtypeanda.coutid=b.csbvcode

wherea.ccodelike'501%'

⏹anda.mc=b.fpje--anda.mc<>b.fpje视审计目标而定

1.4检查每笔业务从发货到记账凭证制单之间相差天数,结果按相差天数降序排列

selectc.iperiod,c.csign,c.ino_id,c.ccode,a.ddate,c.dbill_date,

datediff(day,a.ddate,c.dbill_date)asts

fromdispatchlista

joinsalebillvouchbona.sbvid=b.sbvid

joingl_accvouchc

onb.cvouchtype=c.coutbillsignandb.csbvcode=c.coutid

--wherec.ccodelike'501%'

orderbydatediff(day,a.ddate,c.dbill_date)desc

selectdistinctc.iperiod,c.csign,c.ino_id,c.ccode,a.ddate,c.dbill_date,

datediff(day,a.ddate,c.

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2