Oracle 分类统计sql.docx

上传人:b****6 文档编号:8648975 上传时间:2023-02-01 格式:DOCX 页数:13 大小:18.67KB
下载 相关 举报
Oracle 分类统计sql.docx_第1页
第1页 / 共13页
Oracle 分类统计sql.docx_第2页
第2页 / 共13页
Oracle 分类统计sql.docx_第3页
第3页 / 共13页
Oracle 分类统计sql.docx_第4页
第4页 / 共13页
Oracle 分类统计sql.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

Oracle 分类统计sql.docx

《Oracle 分类统计sql.docx》由会员分享,可在线阅读,更多相关《Oracle 分类统计sql.docx(13页珍藏版)》请在冰豆网上搜索。

Oracle 分类统计sql.docx

Oracle分类统计sql

Oracle分类统计sql

--按店铺分类统计订单状态

select sum(A)as 已付款 ,sum(B)as 未付款,Cas 店铺名

from

 select case when status_id=2then 1else 0end  AS A,

        case when status_id=4then 1else 0end  AS B,

        shop_idAS C from t_xs_tradewhere status_idin(2,4)

)group by C;

  

结果:

   

已付款

未付款

店铺名

1

62

5

shop04

2

173

229

shop02

3

1

1

shop08

4

27

0

shop01

5

3

0

shop06

6

103

38

855006870

 

 

 

 

 

 

 

表结构:

TIDVARCHAR2(30)N订单编号

SHOP_IDVARCHAR2(30)Y店铺ID

SHOP_NAMEVARCHAR2(50)Y店铺名称

PT_IDVARCHAR2(10)Y平台ID

STATUS_IDVARCHAR2(35)Y订单状态ID

FROM_IDVARCHAR2(30)Y来源单号

SHIP_IDVARCHAR2(30)Y物流单号

TYPEVARCHAR2(100)Y交易类型列表

BUYER_IDVARCHAR2(20)Y买家账号

BUYER_NAMEVARCHAR2(50)Y买家名称

NUMNUMBER(6)Y商品数量

PAYMENT_TIMEVARCHAR2(50)Y付款时间

TOTAL_FEENUMBER(6,2)Y商品金额

TRADE_FEENUMBER(6,2)Y订单金额

DEAL_FEENUMBER(6,2)Y应付金额

PAYMENTNUMBER(6,2)Y实付金额

DISCOUNT_FEENUMBER(6,2)Y优惠金额

POST_FEENUMBER(4,2)Y邮费

SHIPPING_TYPEVARCHAR2(30)Y物流方式;卖家包邮,平邮,快递,EMS,虚拟发货

BUYER_MEMOVARCHAR2(500)Y买家备注

SELLER_MEMOVARCHAR2(500)Y卖家备注

CREATE_TIMEVARCHAR2(50)Y下单日期

MODIFIED_TIMEVARCHAR2(50)Y订单更新日期

END_TIMEVARCHAR2(50)Y交易结束日期

PAYMAENT_TYPEVARCHAR2(20)Y买家支付方式

BUYER_ALIPAY_NOVARCHAR2(30)Y买家支付流水号

RECEIVER_NAMEVARCHAR2(20)Y收获人姓名

RECEIVER_STATEVARCHAR2(30)Y收货人所在省份

RECEIVER_CITYVARCHAR2(30)Y收货人所在城市

RECEIVER_DISTRICTVARCHAR2(100)Y收货人所在地区

RECEIVER_ADDRESSVARCHAR2(200)Y收货人详细地址

RECEIVER_ZIPVARCHAR2(15)Y收货人邮编

RECEIVER_MOBILEVARCHAR2(20)Y收货人手机

RECEIVER_PHONEVARCHAR2(20)Y收货人电话

AVAILABLE_CONFIRM_FEENUMBER(6,2)Y交易中剩余的确认收获金额

RECEIVED_PAYMENTNUMBER(6,2)Y卖家实际收到的第三方平台支付金额

INVOICE_INFOVARCHAR2(500)Y发票信息

POINT_FEENUMBER(6)Y买家实际使用的积分

SELLER_RECVRE_FUNDNUMBER(6,2)Y卖家实际收到金额

BUYER_RECVRE_FUNDNUMBER(6,2)Y买家收到的退款金额

BUYER_OBTAIN_POINT_FEENUMBER(6)Y交易成功后买家获得的积分

IS_MERGE_ORDERVARCHAR2(51)Y0正常订单1合并订单2手动合并订单

WAREHOUSEVARCHAR2(10)Y对应仓库

AIRLINESVARCHAR2(10)Y客服

URGENT_TASKVARCHAR2(15)Y加急任务

URGENT_TASK_NAMEVARCHAR2(20)Y加急任务名称

PROMOTION_NAMEVARCHAR2(20)Y优惠信息的名称

PROMOTION_DISCOUNT_FEENUMBER(6,2)Y优惠金额(免运费、限时打折时为空),单位:

GIFT_ITEM_NAMEVARCHAR2(20)Y满就送商品时,所送商品的名称

GIFT_ITEM_IDVARCHAR2(20)Y赠品的宝贝id

GIFT_ITEM_NUMNUMBER

(2)Y满就送礼物的礼物数量

PROMOTION_DESCVARCHAR2(200)Y优惠活动的描述

PROMOTION_IDVARCHAR2(50)Y优惠id,(由营销工具id、优惠活动id和优惠详情id组成,结构为:

营销工具id-优惠活动id_优惠详情id,如mjs-123024_211143)

TO_ERPCHAR(5)Y01:

已推送到ERP;0:

未推送到ERP

BUYER_ALIPAY_IDVARCHAR2(50)Y买家支付账号

表结构sql语句形式

--Createtable

createtableT_XS_TRADE

TIDVARCHAR2(30)notnull,

SHOP_IDVARCHAR2(30),

SHOP_NAMEVARCHAR2(50),

PT_IDVARCHAR2(10),

STATUS_IDVARCHAR2(35),

FROM_IDVARCHAR2(30),

SHIP_IDVARCHAR2(30),

TYPEVARCHAR2(100),

BUYER_IDVARCHAR2(20),

BUYER_NAMEVARCHAR2(50),

NUMNUMBER(6),

PAYMENT_TIMEVARCHAR2(50),

TOTAL_FEENUMBER(6,2),

TRADE_FEENUMBER(6,2),

DEAL_FEENUMBER(6,2),

PAYMENTNUMBER(6,2),

DISCOUNT_FEENUMBER(6,2),

POST_FEENUMBER(4,2),

SHIPPING_TYPEVARCHAR2(30),

BUYER_MEMOVARCHAR2(500),

SELLER_MEMOVARCHAR2(500),

CREATE_TIMEVARCHAR2(50),

MODIFIED_TIMEVARCHAR2(50),

END_TIMEVARCHAR2(50),

PAYMAENT_TYPEVARCHAR2(20),

BUYER_ALIPAY_NOVARCHAR2(30),

RECEIVER_NAMEVARCHAR2(20),

RECEIVER_STATEVARCHAR2(30),

RECEIVER_CITYVARCHAR2(30),

RECEIVER_DISTRICTVARCHAR2(100),

RECEIVER_ADDRESSVARCHAR2(200),

RECEIVER_ZIPVARCHAR2(15),

RECEIVER_MOBILEVARCHAR2(20),

RECEIVER_PHONEVARCHAR2(20),

AVAILABLE_CONFIRM_FEENUMBER(6,2),

RECEIVED_PAYMENTNUMBER(6,2),

INVOICE_INFOVARCHAR2(500),

POINT_FEENUMBER(6),

SELLER_RECVRE_FUNDNUMBER(6,2),

BUYER_RECVRE_FUNDNUMBER(6,2),

BUYER_OBTAIN_POINT_FEENUMBER(6),

IS_MERGE_ORDERVARCHAR2(51),

WAREHOUSEVARCHAR2(10),

AIRLINESVARCHAR2(10),

URGENT_TASKVARCHAR2(15),

URGENT_TASK_NAMEVARCHAR2(20),

PROMOTION_NAMEVARCHAR2(20),

PROMOTION_DISCOUNT_FEENUMBER(6,2),

GIFT_ITEM_NAMEVARCHAR2(20),

GIFT_ITEM_IDVARCHAR2(20),

GIFT_ITEM_NUMNUMBER

(2),

PROMOTION_DESCVARCHAR2(200),

PROMOTION_IDVARCHAR2(50),

TO_ERPCHAR(5)default0,

BUYER_ALIPAY_IDVARCHAR2(50)

tablespaceUSERS

pctfree10

initrans1

maxtrans255

storage

initial64K

next8K

minextents1

maxextentsunlimited

);

--Addcommentstothetable

commentontableT_XS_TRADE

is'订单表';

--Addcommentstothecolumns

commentoncolumnT_XS_TRADE.TID

is'订单编号';

commentoncolumnT_XS_TRADE.SHOP_ID

is'店铺ID';

commentoncolumnT_XS_TRADE.SHOP_NAME

is'店铺名称';

commentoncolumnT_XS_TRADE.PT_ID

is'平台ID';

commentoncolumnT_XS_TRADE.STATUS_ID

is'订单状态ID';

commentoncolumnT_XS_TRADE.FROM_ID

is'来源单号';

commentoncolumnT_XS_TRADE.SHIP_ID

is'物流单号';

commentoncolumnT_XS_TRADE.TYPE

is'交易类型列表';

commentoncolumnT_XS_TRADE.BUYER_ID

is'买家账号';

commentoncolumnT_XS_TRADE.BUYER_NAME

is'买家名称';

commentoncolumnT_XS_TRADE.NUM

is'商品数量';

commentoncolumnT_XS_TRADE.PAYMENT_TIME

is'付款时间';

commentoncolumnT_XS_TRADE.TOTAL_FEE

is'商品金额';

commentoncolumnT_XS_TRADE.TRADE_FEE

is'订单金额';

commentoncolumnT_XS_TRADE.DEAL_FEE

is'应付金额';

commentoncolumnT_XS_TRADE.PAYMENT

is'实付金额';

commentoncolumnT_XS_TRADE.DISCOUNT_FEE

is'优惠金额';

commentoncolumnT_XS_TRADE.POST_FEE

is'邮费';

commentoncolumnT_XS_TRADE.SHIPPING_TYPE

is'物流方式;卖家包邮,平邮,快递,EMS,虚拟发货';

commentoncolumnT_XS_TRADE.BUYER_MEMO

is'买家备注';

commentoncolumnT_XS_TRADE.SELLER_MEMO

is'卖家备注';

commentoncolumnT_XS_TRADE.CREATE_TIME

is'下单日期';

commentoncolumnT_XS_TRADE.MODIFIED_TIME

is'订单更新日期';

commentoncolumnT_XS_TRADE.END_TIME

is'交易结束日期';

commentoncolumnT_XS_TRADE.PAYMAENT_TYPE

is'买家支付方式';

commentoncolumnT_XS_TRADE.BUYER_ALIPAY_NO

is'买家支付流水号';

commentoncolumnT_XS_TRADE.RECEIVER_NAME

is'收获人姓名';

commentoncolumnT_XS_TRADE.RECEIVER_STATE

is'收货人所在省份';

commentoncolumnT_XS_TRADE.RECEIVER_CITY

is'收货人所在城市';

commentoncolumnT_XS_TRADE.RECEIVER_DISTRICT

is'收货人所在地区';

commentoncolumnT_XS_TRADE.RECEIVER_ADDRESS

is'收货人详细地址';

commentoncolumnT_XS_TRADE.RECEIVER_ZIP

is'收货人邮编';

commentoncolumnT_XS_TRADE.RECEIVER_MOBILE

is'收货人手机';

commentoncolumnT_XS_TRADE.RECEIVER_PHONE

is'收货人电话';

commentoncolumnT_XS_TRADE.AVAILABLE_CONFIRM_FEE

is'交易中剩余的确认收获金额';

commentoncolumnT_XS_TRADE.RECEIVED_PAYMENT

is'卖家实际收到的第三方平台支付金额';

commentoncolumnT_XS_TRADE.INVOICE_INFO

is'发票信息';

commentoncolumnT_XS_TRADE.POINT_FEE

is'买家实际使用的积分';

commentoncolumnT_XS_TRADE.SELLER_RECVRE_FUND

is'卖家实际收到金额';

commentoncolumnT_XS_TRADE.BUYER_RECVRE_FUND

is'买家收到的退款金额';

commentoncolumnT_XS_TRADE.BUYER_OBTAIN_POINT_FEE

is'交易成功后买家获得的积分';

commentoncolumnT_XS_TRADE.IS_MERGE_ORDER

is'0正常订单1合并订单2手动合并订单';

commentoncolumnT_XS_TRADE.WAREHOUSE

is'对应仓库';

commentoncolumnT_XS_TRADE.AIRLINES

is'客服';

commentoncolumnT_XS_TRADE.URGENT_TASK

is'加急任务';

commentoncolumnT_XS_TRADE.URGENT_TASK_NAME

is'加急任务名称';

commentoncolumnT_XS_TRADE.PROMOTION_NAME

is'优惠信息的名称';

commentoncolumnT_XS_TRADE.PROMOTION_DISCOUNT_FEE

is'优惠金额(免运费、限时打折时为空),单位:

元';

commentoncolumnT_XS_TRADE.GIFT_ITEM_NAME

is'满就送商品时,所送商品的名称';

commentoncolumnT_XS_TRADE.GIFT_ITEM_ID

is'赠品的宝贝id';

commentoncolumnT_XS_TRADE.GIFT_ITEM_NUM

is'满就送礼物的礼物数量';

commentoncolumnT_XS_TRADE.PROMOTION_DESC

is'优惠活动的描述';

commentoncolumnT_XS_TRADE.PROMOTION_ID

is'优惠id,(由营销工具id、优惠活动id和优惠详情id组成,结构为:

营销工具id-优惠活动id_优惠详情id,如mjs-123024_211143)';

commentoncolumnT_XS_TRADE.TO_ERP

is'1:

已推送到ERP;0:

未推送到ERP';

commentoncolumnT_XS_TRADE.BUYER_ALIPAY_ID

is'买家支付账号';

--Create/Recreateprimary,uniqueandforeignkeyconstraints

altertableT_XS_TRADE

addconstraint订单编号primarykey(TID)

usingindex

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

--Create/Recreateindexes

createindex平台名称onT_XS_TRADE(PT_ID)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

createindex店铺名称onT_XS_TRADE(SHOP_ID)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

createindex收货人所在城市onT_XS_TRADE(RECEIVER_CITY)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

createindex收货人所在省份onT_XS_TRADE(RECEIVER_STATE)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

createindex物流方式onT_XS_TRADE(SHIPPING_TYPE)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

createindex订单状态onT_XS_TRADE(STATUS_ID)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

createindex订单金额onT_XS_TRADE(TRADE_FEE)

tablespaceUSERS

pctfree10

initrans2

maxtrans255

storage

initial64K

next1M

minextents1

maxextentsunlimited

);

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

当前位置:首页 > 工程科技 > 机械仪表

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1