Course Content
Intermediate SQL
2. Nested Subqueries
4. Left, Right, and Inner Joins
Intermediate SQL
Challenge: Number of Stations
Note
COUNT(column)
is the function that counts the number of rows.
Task
Using the relation
table, find the number of stations (create a new column, named number_of_stations
using station_name
and COUNT()
function) for each of the lines (line_name
).
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 2