数据库学习(三) sql语句中添加函数 to_char,round,连接符||

** to char 是把日期或数字转换为字符串 
  to date 是把字符串转换为数据库中得日期类型   

  参考资料:https://www.cnblogs.com/hllnj2008/p/5332962.html

** || 字符串连接符 

  参考资料:https://www.cnblogs.com/forget406/p/5506394.html

** round 函数,用于把数值字段舍入为指定的小数位数

  参考资料:http://www.w3school.com.cn/sql/sql_func_round.asp

--查询脚本
select to_char(stat_date,'yyyy')||''||to_char(stat_date,'mm')||''||to_char(stat_date,'dd')||'' 统计时间 ,
       new_users_num 新增用户量 ,
       new_users_pay_rate*100||'%' 新增付款转化率 ,
       new_active_user_num 新增活跃用户量 ,
       new_active_user_rate*100||'%' 新增活跃占比 ,
       order_pay_rate*100||'%' 订单付款率 ,
       round(order_pay_amount,2) 付款订单金额 ,
       round(new_order_pay_amount,2) 新增付款订单金额 ,
       new_order_rate*100||'%' 新增付款金额占比 ,
       round(user_unit_price,2) 客单价 ,
       round(order_trading_num,2)  成交笔数,
       order_trading_amount 成交金额 ,
       order_settled_num 已完成订单量 ,
       round(order_settled_amount,2) 已完成订单金额 
  from dataayn_v1.stat_new_user_trade_day a
  order by a.stat_date desc ;

select * from dataayn_v1.stat_new_user_trade_day a;

 

转载于:https://www.cnblogs.com/xiaoyu2018/p/10215033.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值