2021.3.26美团-大数据开发-实习-一面

select student.id,student.name,book.stu_id ,count(*) as total from student, book wherestudent.id=book.stu_id and student.age=18 and student.gender=‘男’group by book.nameorder by total desc limit 1;面试时没看到book中id是否为主键的问题,如果为主键那么久不能有重复值,假设book的name是没有重复的,.
摘要由CSDN通过智能技术生成

在这里插入图片描述
select student.id,student.name,book.stu_id ,count(*) as total from student, book where
student.id=book.stu_id and student.age=18 and student.gender=‘男’
group by book.name
order by total desc limit 1;
面试时没看到book中id是否为主键的问题,如果为主键那么久不能有重复值,假设book的name是没有重复的,所以按照book的名称分组,然后计算每组的数目,降序排列取第一个。正产应该有个borrow_id,为主键,然后按照book_id分组。

HashMap的底层实现原理:
底层数据结构:数组+链表+红黑树(jdk1.8后)
HashMap可以接受null键值和值,线程不安全,HashMap使用链表来解决碰撞问题,当发生碰撞了,对象将会储存在链表的下一个节点中。
HashMap是基于hashing的原理,我们使用put(key,value)存储对象到HashMap中,使用get(key)从HashMap中获取对象。当我们给put()方法传递键和值时,

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值