尚德机构

尚德机构

  • 岗位:数据产品实习生
  • 面试流程:一面HR填表,二面技术主管
  • 面试内容:Mysql查询,简历内容

面试题目:查询同时通过直播和录播两种方式上课的学生。

(1) 
select a.* from tab1 as a,tab1 as b
where a.id = b.id and a.type = '直播' and b.type = '录播';
(2)
select * from tab1 where id in 
(select id from tab1 where type = '直播' and id in 
(select id from tab1 where type = '录播'));
(3)
select a.* from tab1 as a join tab2 as b using(id)
where a.type = '直播' and b.type = '录播'
(4)
select * from tab1 where id in 
(select id from 
(select id from tab1 where type = '直播') as a
(select id from tab1 where tupe = '录播') as c
where a.id = b.id);

心得
mysql语句不熟练,遇到问题不能马上有思路,下一步要对所学进行总结。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容