尚德機(jī)構(gòu)
- 崗位:數(shù)據(jù)產(chǎn)品實(shí)習(xí)生
- 面試流程:一面HR填表,二面技術(shù)主管
- 面試內(nèi)容:Mysql查詢,簡(jiǎn)歷內(nèi)容
面試題目:查詢同時(shí)通過(guò)直播和錄播兩種方式上課的學(xué)生。
(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語(yǔ)句不熟練,遇到問(wèn)題不能馬上有思路,下一步要對(duì)所學(xué)進(jìn)行總結(jié)。