尚德机构
- 岗位:数据产品实习生
- 面试流程:一面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语句不熟练,遇到问题不能马上有思路,下一步要对所学进行总结。