hc学习平台

 找回密码
 立即注册
搜索
热搜: 活动 交友 javakc
 › 晓旭 › 日志

根据教材中的user表和card表进行多表查询

2021-01-07 10:00:04 查看(365) 回复(0)

完成以下功能:


  1. 查询【李峰】的银行卡信息
  2. 查询银行卡号是【001】的客户信息
  3. 查询存款大于10000元的客户姓名和身份证号码
  4. 查询信用积分大于400分的客户姓名和银行存款总额
  5. 查询每个城市的银行存款总额,按存款金额降序排列
  6. 查询在2019年1月1日至2019年3月1日期间,办理新银行卡的客户信息
  7. 查询银行存款大于等于20000元的北京客户信息
  8. 统计男客户、女客户的平均存款金额
  9. 统计每个城市银行卡的数量,要求不包括被冻结的银行卡
  10. 查询每个客户的存款总额
  11. 查询人均存款大于20000的城市名称


select card.*from card,user where name='李峰'and `user`.userId=card.userId;

select user.* from card,user where cardNo='001'and card.userId=`user`.userId

select `user`.`name`,`user`.personId from card,user where money>10000 and card.userId=`user`.userId;

select `user`.`name`,card.money from card,user where credit>400 and card.userId=`user`.userId;

select city,sum(money) c from card,user where  card.userId=`user`.userId GROUP BY city ORDER BY c ;

select user.* from card,user where openDate BETWEEN '2019-01-01' and '2019-03-01' and `user`.userId=card.userId;

select user.*  from card,user where city='北京'and money>20000 and `user`.userId=card.userId;

select  user.sex,AVG(money) from card,user  GROUP BY user.sex

select city,count(cardNo) from card,user where card.isLock='0' and `user`.userId=card.userId GROUP BY city  ;

select `user`.`name`,sum(money) from card,user  where `user`.userId=card.userId GROUP BY `user`.`name`;

select city from card,user where `user`.userId=card.userId GROUP BY city HAVING AVG(money)>10000;

评论 (0 个评论)

facelist

全部作者的其他最新日志



站点统计|举报|Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, , Processed in 0.195171 second(s), 9 queries .

Powered by javakc! X1.0

© 2004-2014 javakc

f1208.com 备案号:京ICP备14030918号-1

返回顶部