為什么強(qiáng)烈建議你不要做聯(lián)表查詢?
點(diǎn)擊上方 好好學(xué)java ,選擇 星標(biāo) 公眾號(hào)
重磅資訊,干貨,第一時(shí)間送達(dá) 今日推薦:寫博客能月入 10K?
個(gè)人原創(chuàng)100W +訪問量博客:點(diǎn)擊前往,查看更多
前言
單表查詢+代碼層組裝 or 聯(lián)表查詢 的問題,在開發(fā)中每個(gè)同學(xué)的開發(fā)中有各自的習(xí)慣,筆者在公司也和一些同事關(guān)于這方面有一些探討。對(duì)比
select * from tag
join tag_post on tag_post.tag_id=tag.id
join post on tag_post.post_id=post.id
where tag.tag='mysql';
select * from tag where tag='mysql';
select * from tag_post where tag_id=1234;
select * from post where id in(123,456,567,9989,8909);
單表 VS 聯(lián)表


更多項(xiàng)目源碼
評(píng)論
圖片
表情
