题解 | #找到每个人的任务#

找到每个人的任务

http://www.nowcoder.com/practice/9dd9182d029a4f1d8c1324b63fc719c9

乍看这个题目,如果选用两表的id进行连接就上当了,主要是看到用person的id连接task的person_id,而且没有任务的也要显示,所以得用left join,最终代码如下:

select p.id,p.name,t.content from person p
left join task t
on p.id = t.person_id
order by p.id
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务