A Gentle Introduction to

SQL


Pick an engine:

Edinburgh Buses

Details of the database. Looking at the data.

1a How many stops are in the database.

1b Find the id value for the stop 'Craiglockhart'

1c List the stops are there on the '4' 'LRT' service.

Routes and stops

2a Obtain a list of the stops on the 'LRT' route '4' in alphabetic order.

2b Obtain a list of the stops on the 'LRT' route '4' in route order.

2c Give the services which pass through 'Craiglockhart'

Using a self join

3a Give a list of all the services which connect stops 115 and 137 ('Haymarket' and 'Leith')

3b Give a list of the services which connect the stops 'Craiglockhart' and 'Tollcross'

3c Give a list of the stops which may be reached from 'Craiglockhart' by taking one bus. Include the details of the appropriate service.

3d Show how it possible to get from Sighthill to Craiglockhart.