Course Content

# Intermediate SQL

2. Nested Subqueries

4. Left, Right, and Inner Joins

Intermediate SQL

## Challenge: The Shortest Ride of Each Subway Line

Note

`MIN(column)`

function returns the smallest value in a particular column.The

`LIMIT`

clause helps you to get a certain number of rows.

# Task

You have to find the shortest trip (create a new column, named `min_time`

using `time_to_next_station`

and `MIN()`

function) of each subway line (`line_name`

column). Order it by the `min_time`

column in **ascending** order and print the first **three** rows.

Here's a short example of the `relation`

table:

relation_id | line_name | station_name | time_to_next_station |

1 | Green | Angrignon | 10 |

2 | Green | Monk | 16 |

3 | Green | Verdun | 9 |

... | ... | ... | ... |

21 | Yellow | Longueuil | 10 |

Everything was clear?

Section 1. Chapter 5