wo56565

每天的审批通过率及审批通过的平均申请金额

select apply_date,sum(result='pass')/count(result) 审批通过率,sum((result='pass')*apply_prin)/sum(result='pass') 审批通过的平均申请金额 from app_list group by apply_date;

wo56565

2020-02-19

0.0000 0 1
  • 关注作者
  • 收藏

近一个月完单大于30单的司机姓名及电话

select driver_name,driver_phone from driver_info left join driver_collect on driver_info.driver_id=driver_collect.driver_id where d_year=2017 and d_month=7 group by driver_info.driver_id having count(

wo56565

2020-02-19

0.0000 0 6
  • 关注作者
  • 收藏

查询6月7日创建的线索在7月1日成交的合同总量

select count(id) from tbl_contract left join tbl_clue on tbl_contract.clue_id=tbl_clue.clue_id where date_format(tbl_clue.created_at,'%m-%d')='06-07' and date_format(tbl_contract.created_at,'%m-%d')='

wo56565

2020-02-19

0.0000 0 4
  • 关注作者
  • 收藏

查询6月7日当天分城市的线索量、平均价格并按照线索量降序排列

select city_id,count(clue_id),avg(price) from tbl_clue where date_format(created_at,'%m-%d')='06-07' group by city_id order by count(clue_id) desc;

wo56565

2020-02-19

0.0000 0 5
  • 关注作者
  • 收藏

面试题:计算归属于10002业务员的投资金额

select sum(invest_amount) from cmn_investment_request a left join dim_agent b on a.user_id=b.user_id and created_at between start_date and end_date where agent_id='10002';

wo56565

2020-02-19

0.0000 0 1
  • 关注作者
  • 收藏

面试题:计算2017年仅投资过CFH和AX产品的用户

select user_id from cmn_investment_request where year(created_at)=2017 group by user_id having group_concat(distinct invest_item order by invest_item desc)='CFH,AX';

wo56565

2020-02-19

0.0000 0 5
  • 关注作者
  • 收藏

面试题:计算2017年每笔投资均大于50万的用户

select user_id from cmn_investment_request where year(created_at)=2017 group by user_id having min(invest_amount)>500000;

wo56565

2020-02-19

0.0000 0 4
  • 关注作者
  • 收藏

mysql中如何实现全连接?

-- MySQL实现全连接 -- select * from t1 full join t2 on key1=key2; select * from t1 left join t2 on key1=key2 union select * from t1 right join t2 on key1=key2;

wo56565

2020-02-19

0.0000 0 5
  • 关注作者
  • 收藏

mysql中几种连接的写法

-- 左连接 select * from t1 left join t2 on key1=key2; -- 右连接 select * from t1 right join t2 on key1=key2; -- 左反连接 select * from t1 left join t2 on key1=key2 where key2 is null; -- 右反连接 select * from

wo56565

2020-02-19

0.0000 0 1
  • 关注作者
  • 收藏

两个表内连接的几种写法

select * from t1 inner join t2 on key1=key2; select * from t1 join t2 on key1=key2; select * from t1,t2 where key1=key2;

wo56565

2020-02-19

0.0000 0 5
  • 关注作者
  • 收藏

用户结束时间在3月份的userid及tel

select t_user.* from t_user left join t_order on t_user.userid=t_order.userid where month(end_time)=3;

wo56565

2020-02-19

0.0000 0 0
  • 关注作者
  • 收藏

面试题第二题:每个userid的最新结束时间

select userid,max(end_time) from t_order group by userid;

wo56565

2020-02-19

0.0000 0 4
  • 关注作者
  • 收藏

mysql 面试题第一题:出现在表a却不在表b的userid

select t_user.userid from t_user left join t_order on t_user.userid=t_order.userid where t_order.userid is null; select userid from t_user where userid not in (select userid from t_order);

wo56565

2020-02-19

0.0000 0 5
  • 关注作者
  • 收藏

数组的元素重复操作

# -*- coding:utf-8 -*- # author: import numpy '''数组的元素重复操作''' x = numpy.array([[1,2],[3,4]]) print(x.repeat(2)) # 按元素重复 [1 1 2 2 3 3 4 4] print(x.repeat(2,axis=0)) # 按行重复 [[1 2][1 2][3 4][3 4]] print(

wo56565

2019-07-18

0.0000 0 2
  • 关注作者
  • 收藏

ndarray数组重塑

# -*- coding:utf-8 -*- # author: import numpy '''ndarray数组重塑''' x = numpy.arange(0,6) #[0 1 2 3 4] print(x) #[0 1 2 3 4] print(x.reshape((2,3))) #) [[0 1 2][3 4 5]] print(x )#[0 1 2 3 4] print(x.resh

wo56565

2019-07-18

0.0000 0 1
  • 关注作者
  • 收藏

numpy中的随机数生成

# -*- coding:utf-8 -*- # author: import numpy as np a=np.random.randint(0,10,100)#范围内的整数 print(a) b=np.random.rand(40)#0到1的均匀分布 print(b) c=np.random.randn(10)#标准正态分布 print(c) d=np.random.normal(0,1,10

wo56565

2019-07-18

0.0000 0 3
  • 关注作者
  • 收藏

ndarray数组的去重以及集合运算

# -*- coding:utf-8 -*- # author: import numpy '''ndarray的唯一化和集合运算''' x = numpy.array([[1,6,2],[6,1,3],[1,5,2]]) print(numpy.unique(x)) # [1,2,3,5,6] y = numpy.array([1,6,5]) print(numpy.in1d(x,y)) #

wo56565

2019-07-18

0.0000 0 1
  • 关注作者
  • 收藏

NumPy的where函数使用

# -*- coding:utf-8 -*- # author: import numpy '''where函数的使用''' cond = numpy.array([True,False,True,False]) x = numpy.where(cond,-2,2) print(x) # [-2 2 -2 2] cond = numpy.array([1,2,3,4]) x = numpy.

wo56565

2019-07-18

0.0000 0 1
  • 关注作者
  • 收藏

ndarray数组的转置和轴对换

# -*- coding:utf-8 -*- # author: import numpy '''ndarray数组的转置和轴对换''' k = numpy.arange(9) #[0,1,....8] m = k.reshape((3,3)) # 改变数组的shape复制生成2维的,每个维度长度为3的数组 print(k )# [0 1 2 3 4 5 6 7 8] print(m )# [[0

wo56565

2019-07-18

150.0000 1 3
  • 关注作者
  • 收藏

ndarray数组的布尔索引和其他索引

# -*- coding:utf-8 -*- # author: import numpy '''ndarray的布尔型索引''' x = numpy.array([3,2,3,1,3,0]) # 布尔型数组的长度必须跟被索引的轴长度一致 y = numpy.array([True,False,True,False,True,False]) print(x[y] )# [3,3,3] pri

wo56565

2019-07-18

0.0000 0 4
  • 关注作者
  • 收藏
<12326>