Self join/zh练习记录20230418

题目链接:Self join/zh - SQLZOO

以下几道题尚未掌握,需更多练习——

4.以下查詢列出途經 London Road (149) 或 Craiglockhart (53)的巴士線號碼。注意有兩條路線會經過這兩個站兩次。 加入 HAVING 語句來限制只列出這兩條路線。

 (**知其然不知其所以然,这道题需要更多体会**)

5.執行自我合拼來,留意b.stop代表由Craiglockhart出發不用轉車可前住的地方。 修改它來顯示由Craiglockhart到 London Road的服務資料。

 (**完全照猫画虎,还未理解**)

6.此題和上題相似,但是用兩個stops表來自我合拼。這樣我們可以用站名而非站編號。 修改它來顯示由Craiglockhart到 London Road的服務資料。 如你太悶,可試一試由 'Fairmilehead' 到 'Tollcross' (系統會當答錯的。正確有3條路線:11,15,315)

 (**self join语句需要继续练习**)

7.列出連接115 和 137 ('Haymarket' 和 'Leith') 的公司名和路線號碼。不要重覆。

 (**两种方式均可**)

9.不重覆列出可以由 'Craiglockhart' 乘一程車到達的站stops,包括'Craiglockhart'本身。 列出站名,公司名和路線號碼。

 10.Find the routes involving two buses that can go from Craiglockhart to Sighthill.
Show the bus no. and company for the first bus, the name of the stop for the transfer,
and the bus no. and company for the second bus.

Hint

Self-join twice to find buses that visit Craiglockhart and Sighthill, then join those on matching stops.

 (**暂时解不出来,暂空,做出来再补充**)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值