zoosql--Self join 解答

这篇博客介绍了SQLZoo中关于Self join的概念和应用。内容包括如何查询数据库中的stop数量,获取特定stop的id,显示特定服务路线上的stop信息,以及使用HAVING子句筛选特定路线。此外,还探讨了如何从Craiglockhart到其他stop的公交服务,特别是到London Road的路线。最后,提供了连接不同stop的公交服务列表,并展示了如何找到从Craiglockhart到Lochend需要换乘的两班公交车路线。
摘要由CSDN通过智能技术生成

Self join

Self join - SQLZOO

  1. How many stops are in the database.
    select count(id) from stops
  2. Find the id value for the stop 'Craiglockhart'
    select id from stops
    where name = 'Craiglockhart'
  3. Give the id and the name for the stops on the '4' 'LRT' service.
    select stops.id , stops.name 
    from stops join route on  stops.id = route.stop
    where num='4' and company = 'LRT'
  4. The query shown gives the number of routes that visit either London Road (149) or Craiglockhart (53). Run the query and notice the two services that link these stops h
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值